Actions, XML Binding, APIs, Dynamic Namespaces, and Credit Card Numbers

JavaScript functions

AboutJavaScript functions for the console JSP interface

The UI uses JavaScript functions to perform client-side
operations such as opening pop-up windows, switching views, validating user input, and so forth.
Most of the JavaScripts used in the UI are provided by the UI infrastructure layer. You can use the
same functions while performing your UI extensions. This section describes the JavaScript functions supplied by the application’s UI layer.

Note that the application also uses JavaScript functions that are not supplied by the UI infrastructure.
These functions usually perform some specific action for some specific screen and are not required
to be used during your UI extensions.

In addition, if you require additional logic for your screen for
which the UI infrastructure does not provide JavaScript functions, you can write and
use your own as needed.

Lookup

callLookup. Uses [GET]

invokeCalendar. Uses [GET]

yfcShowSearchPopup. Uses [GET]

Control Name

ignoreChangeNames

yfcDoNotPromptForChanges

yfcDoNotPromptForChangesForActions

yfcHasControlChanged

yfcSetControlAsUnchanged

yfcSpecialChangeNames

Event Handler

validateControlValues

yfcBodyOnLoad

yfcGetSaveSearchHandle

yfcGetSearchHandle

yfcValidateMandatoryNodes

Show Detail

showDetailFor. Uses [GET]

showPopupDetailFor. Uses [GET]

yfcChangeDetailView. Uses [POST]

yfcShowDefaultDetailPopupForEntity. Uses [GET]

yfcShowDetailPopupWithDynamicKey

yfcShowDetailPopupWithKeys. Uses [GET]

yfcShowDetailPopupWithParams

Show List Pop-up

yfcShowListPopupWithParams. Uses [GET]

Other

doCheckAll

doCheckFirstLevel

expandCollapseDetails

getAttributeNameFromBinding

getCurrentSearchViewId

getCurrentViewId

getObjectByAttrName

goToURL

yfcAllowSingleSelection

yfcDisplayOnlySelectedLines

setRetrievedRecordCount

CallLookup

You can review the details about callLookup.

Description

This JavaScript function displays
a lookup screen that enables the user to search for and select a record
to use in the current screen. For example, an organization lookup
on the order entry screen enables the user to select a buyer organization.
Typically, you should attach this function to the onclick event of
an image within your JSP page.

Syntax

callLookup(obj,entityname,extraParams)

Input parameters

entityname – Optional.
Entity to search for in the lookup screen. If not passed, defaults
to the name of the current entity.

obj – Required. Handle
to the image being selected.

extraParams – Optional.
Passes extra parameters to the lookup screen. The format of the parameter
is name/value pairs in URL format. If passed, the parameters are passed
to the lookup screen.

Output parameters

None.

Example

This
example shows how to show an organization lookup that defaults the
display of the seller role in the buyer Role field on the lookup:

<img class="lookupicon" 
onclick="callLookup(this,'organization',
'xml:/Organization/OrgRoleList/OrgRole/@RoleKey=BUYER')" name="search"
<%=getImageOptions(YFSUIBackendConsts.LOOKUP_ICON, "Search_for_Buyer") %> />

DoCheckAll

You can review the details about the doCheckAll JavaScript function.

Description

This JavaScript function toggles
the state of all the checkboxes in a table, using the following assumptions:

  • The table must have separate head and body sections.
  • Checkboxes within the body section must have the same column index
    as the specified checkbox object. Cells containing multiple checkboxes
    are all toggled.

Syntax

doCheckAll(obj)

Input parameters

obj – Optional. Handle to the checkbox
object (in HTML object hierarchy) on a table header. If the object
is not passed, the function just returns.

Return values

None.

Example

This
example shows how an order list view showing order number and enterprise
would handle the check all and uncheck all option in the table header
row.

<table class="table" editable="false" width="100%" cellspacing="0">
	<thead> 
		<tr>
			<td sortable="no" class="checkboxheader">
				<input type="checkbox" name="checkbox" value="checkbox" 
onclick="doCheckAll(this);"/>
			</td>
				<td class="tablecolumnheader"><yfc:i18n>Order_#</yfc:i18n></td>
	 		<td class="tablecolumnheader"><yfc:i18n>Enterprise</yfc:i18n></td>
			</tr>
	</thead>
	<tbody>
		 <yfc:loopXML binding="xml:/OrderList/@Order" id="Order">
		 	<tr>
				  <yfc:makeXMLInput name="orderKey">
					   <yfc:makeXMLKey binding="xml:/Order/@OrderHeaderKey"
value="xml:/Order/@OrderHeaderKey" />
						</yfc:makeXMLInput>
      <td class="checkboxcolumn"> 
						  <input type="checkbox" value='<%=getParameter("orderKey")%>' 
name="EntityKey"/>
						</td>
						<td class="tablecolumn">
        <a href="javascript:showDetailFor('<%=getParameter("orderKey")%>');">
							    <yfc:getXMLValue binding="xml:/Order/@OrderNo"/>
         </a>
						</td>
						<td class="tablecolumn"><yfc:getXMLValue 
binding="xml:/Order/@EnterpriseCode"/>
       </td>
				</tr>
			</yfc:loopXML>
	</tbody> 
</table>

DoCheckFirstLevel

You can review the information on the doCheckFirstLevel JavaScript function.

Description

This JavaScript function is used
on the onclick event of a checkbox in the table column header. The
function checks or unchecks all checkboxes in the first level
of checkboxes in the table. This function is very similar to the doCheckAll JavaScript function, except
that doCheckAll checks or unchecks all checkboxes within the
specified HTML table.

Use this function for HTML tables that
require this “(un)check all” functionality and also have one or more
unrelated checkboxes inside the table that should not be affected
by the selection checkboxes.

Syntax

doCheckFirstLevel(obj)

Input parameters

obj – Optional. Handle to the checkbox
object (in HTML object hierarchy) on a table header. If the object
is not passed, the function does nothing.

Output parameters

None.

Example

This
example shows the table header definition for a list of items containing
a checkbox where the user can select one or more items in the table.
The header row of the table contains a checkbox. When this checkbox
is selected, all of the first level check boxes within the HTML table
are checked or unchecked.

<table class="table" cellspacing="0" width="100%">
   <thead>
     <tr>
       <td class="checkboxheader" sortable="no" style="width:10px">
         <input type="checkbox" value="checkbox" name="checkbox" 
onclick="doCheckFirstLevel(this);"/>
        </td>
         <td class="tablecolumnheader" 
style="width:30px"><yfc:i18n>Options</yfc:i18n></td>
         <td class="tablecolumnheader" 
style="width:<%=getUITableSize("xml:AdditionalServiceItem:/OrderLine/
AdditionalServiceItems/Item/@ItemID")%>"><yfc:i18n>Item_ID</yfc:i18n></td>
         <td class="tablecolumnheader" 
style="width:<%=getUITableSize("xml:AdditionalServiceItem:/OrderLine/
AdditionalServiceItems/Item/@UnitOfMeasure")%>"><yfc:i18n>UOM</yfc:i18n></td>
         <td class="tablecolumnheader" 
style="width:<%=getUITableSize("xml:AdditionalServiceItem:/OrderLine/
AdditionalServiceItems/Item/PrimaryInformation/@Description")%>">
<yfc:i18n>Item_Description</yfc:i18n></td>
         <td class="tablecolumnheader" 
style="width:<%=getUITableSize("xml:AdditionalServiceItem:/OrderLine/
AdditionalServiceItems/Item/@Price")%>"><yfc:i18n>Price</yfc:i18n></td>
     </tr>
   </thead>

ExpandCollapseDetails

You can review the details on the expandCollapseDetails JavaScript function.

Description

This JavaScript function toggles
the display state of the specified tags that have expanded and collapsed
views.

Syntax

expandCollapseDetails(div_id,
expandAlt, collapseAlt, expandgif, collapsegif)

Input parameters

div_id – Required. Identifier of the object
to expand or collapse.

expandAlt – Required. Tooltip
to show for expanding a selection. This tooltip shows when the object
is in a collapsed state.

collapseAlt – Required. Tooltip
to show for collapsing a selection. Available when the object is an
expanded state.

expandgif – Required. Image to show when
the selection is in a collapsed state.

collapsegif
Required. Image to show when the selection is in an expanded state.

Return value

None.

Example

This
example shows how the expandCollapseDetails() function can be used
in a table to hide some advanced information that the user can retrieve
by selecting a special icon at line level. The example shows how payment
collection details, such as credit card number, can be viewed by selecting
the plus (+) icon. The example also shows div, which enables you to
specify whether to hide or show information. By default, the div is
hidden (display:none).

<tbody>
	<yfc:loopXML
binding="xml:/Order/ChargeTransactionDetails/@ChargeTransactionDetail" 
id="ChargeTransactionDetail">
   <%request.setAttribute("ChargeTransactionDetail", 
YFCElement)pageContext.getAttribute("ChargeTransactionDetail"));%>
    <yfc:makeXMLInput name="InvoiceKey">
      <yfc:makeXMLKey binding="xml:/GetOrderInvoiceDetails/@InvoiceKey" 
value="xml:/ChargeTransactionDetail/@OrderInvoiceKey" />                                                       
     </yfc:makeXMLInput>
     <tr>
        <td class="tablecolumn"
sortValue="<%=getDateValue("xml:ChargeTransactionDetail:/
ChargeTransactionDetail/@Createts")%>">
       <yfc:getXMLValue 
binding="xml:/ChargeTransactionDetail/@Createts"/>
        </td>
        <td class="tablecolumn"> 
        <yfc:getXMLValue 
binding="xml:/ChargeTransactionDetail/@ChargeType"/>
        <% if 
(equals("AUTHORIZATION",getValue("ChargeTransactionDetail",
"xml:/ChargeTransactionDetail/@ChargeType")) || 
equals("CHARGE",getValue("ChargeTransactionDetail",
"xml:/ChargeTransactionDetail/@ChargeType"))) {%>
                <% String divToDisplay="yfsPaymentInfo_" + 
ChargeTransactionDetailCounter; %>
                <img onclick="expandCollapseDetails('<%=divToDisplay%>',
'<%=getI18N("Click_To_See_Payment_Info")%>',
'<%=getI18N("Click_To_Hide_Payment_Info")%>',
'<%=YFSUIBackendConsts.FOLDER_COLLAPSE%>',
'<%=YFSUIBackendConsts.FOLDER_EXPAND%>')" style="cursor:hand" 
<%=getImageOptions(YFSUIBackendConsts.FOLDER,"Click_To_See_Payment_Info")%>/>                       
                  
style="display:none;padding-top:5px">
<%}%> </td> <td class="numerictablecolumn" sortValue="<%=getNumericValue("xml:ChargeTransactionDetail:/ ChargeTransactionDetail/@CreditAmount")%>"> <yfc:getXMLValue binding="xml:/ChargeTransactionDetail/ @CreditAmount"/> </td> </tr> </yfc:loopXML> </tbody>

GetAttributeNameFromBinding

You can review the details about the getAttributeNameFromBinding JavaScript function.

Description

This JavaScript function parses
the binding string passed as input and returns the attribute from
the string.

Syntax

getAttributeNameFromBinding(str)

Input parameters

str – Optional.
String containing the binding string. If not passed, the function
returns null.

Return value

Attribute portion of the binding string.

GetCurrentSearchViewId

You can review the details about the getCurrentSearchViewId JavaScript function.

Description

This JavaScript function retrieves
the Resource ID of the current search view. This function can be used
only for search views. To get the Resource ID of the current detail
view, use the getCurrentViewId JavaScript function
on the detail view JSP page.

Syntax

getCurrentSearchViewId()

Input parameters

None.

Return value

Resource ID of the current search view.

Example

This example shows how to refresh
the current search view when a value is selected from a combo box
by obtaining the current View ID.

<select class="combobox" onChange="changeSearchView(getCurrentSearchViewId())" 
<%=getComboOptions(documentTypeBinding)%>>
   <yfc:loopOptions 
binding="xml:CommonDocumentTypeList:/DocumentParamsList/@DocumentParams" 
name="Description" value="DocumentType" selected="<%=selectedDocumentType%>"/> 
</select>

GetCurrentViewId

You can review the details about the getCurrentViewId JavaScript function.

Description

This JavaScript function retrieves
the Resource ID of the current detail view.

Syntax

getCurrentViewId()

Input parameters

None.

Return value

Resource ID of the current detail view.

Example

This
example shows how to refresh the current view by obtaining the current
View ID.

<td class="detaillabel" ><yfc:i18n>Horizon_End_Date</yfc:i18n></td> 
<td class="protectedtext" nowrap="true">
  <input type="text" class="dateinput" onkeydown="return checkKeyPress(event)"
<%=getTextOptions("xml:/InventoryInformation/Item/@EndDate","xml:/
InventoryInformation/Item/@EndDate","")%> />
  <img class="lookupicon" onclick="invokeCalendar(this);return false" 
<%=getImageOptions(YFSUIBackendConsts.DATE_LOOKUP_ICON,"View_Calendar")%>/>
  <input type="button" class="button" value="GO" 
onclick="if(validateControlValues())changeDetailView(getCurrentViewId())"/> 
</td>

GetObjectByAttrName

You can review the details about the getObjectByAttrName JavaScript function. This JavaScript function returns the object that is bound to the specified attribute.

Description

Binding
is achieved through the use of a JSP function such as getTextOptions
or getComboOptions.

Once a field is bound,
the name attribute of that field contains the binding XML path. This JavaScript function searches
for all input and combo boxes and text areas within the specified
HTML tag, and matches the attribute portion of the name attribute.
The first match is returned.

The attribute portion is separated
from the rest of the name attribute by the at (@) separator. For example,
if the name is xml:/Order/@ChargeNameKey, the attribute portion is ChargeNameKey.

Syntax

getObjectByAttrName(obj,
attributeName)

Input
parameters

obj – Required. Handle to the HTML object
under which the search is to be conducted.

attributeName
Optional. Attribute name for search to be conducted under the object
specified. If not passed, the function returns null.

Return
value

Handle to the object that is bound to the attribute
specified. If no such object is found, null is returned.

Example

This
example shows how to enable and disable the charge name field on line
taxes, based on the checking of a checkbox.

function setAsPriceCharge(thisCheckbox) {
  var checkboxName=thisCheckbox.name
  var trNode=getParentObject(thisCheckbox, "TR");
  var sel=getObjectByAttrName(trNode, "ChargeNameKey"); 
 
  if (sel != null) {
    if (thisCheckbox.checked){
      sel.disabled=true;
      sel.value="";   
     } else {
       sel.disabled=false; 
     }
   } 
 }

GetParentObject

You can review the details of the getParentObject JavaScript function.

Description

This JavaScript function gets the
first occurrence of the tag specified in the HTML ancestry of the
passed object.

Syntax

getParentObject(obj,
tag)

Input parameters

obj – Required. Handle to an object in
HTML object hierarchy.

tag – Optional. String containing
the name of the ancestor node used in a search. If not passed, the
function returns null.

Return values

The first occurrence of the tag specified in the
HTML ancestry of the passed object.

Example

This
example shows how to code a client-side deletion to run when the user
selects a Delete icon in a table row. In this example, element refers
to the object that the user selects.

function deleteRow(element) {
	var row=getParentObject(element, "TR");
	oTable=getParentObject(row, "TABLE");
	row.parentNode.deleteRow(row.rowIndex - 1);
	fireRowsChanged(oTable);
	return false; 
}

GoToURL

You can review the details on the goToURL JavaScript function.

Description

This JavaScript function opens
a specified URL in a new window.

Syntax

goToURL(URLInput)

Input parameters

URLInputObj – Optional.
Name of the input tag that contains the URL specified by the user.
If not passed, the function just returns.

Return value

None.

Example

This
example shows how the goToUrl() function opens the order instruction
screen in a new window.

<td> 
   <input type="text" 
<%=yfsGetTextOptions("xml:/Order/Instructions/Instruction_" 
+ InstructionCounter + "/@InstructionURL", "xml:/Instruction/@InstructionURL",
"xml:/Order/AllowedModifications")%>/>
   <input type="button" class="button" value="GO" 
onclick="javascript:goToURL('xml:/Order/Instructions/
Instruction_<%=InstructionCounter%>/@InstructionURL');"/> 
</td>

IgnoreChangeNames

You can review the details about the IgnoreChangeNames function.

Description

Whenever
any detail view is posted, the Presentation Framework checks for data
changed through the screen controls. For controls that have no changes,
the name attribute is changed to “old” + [current name]. By doing
this, the data in these controls does not make it to the APIs. This
results in improved performance, since unchanged data does not need
to be updated. However, some APIs are designed to work in replace
mode. They take a complete snapshot of information (including unchanged
part) and replace the all of it in the database. For such APIs, all
data from the screen must be passed as input.

To achieve this,
this function can be called in the onload event. This function sets
a custom property in the window object. When the screen is posted,
the Presentation Framework checks for this custom property. If the
property is set, the automatic name changing does not happen.

The
Presentation Framework helps the user remember to save data they have
input. When a user has changed some data and begins to navigate away
from a page, the Presentation Framework detects the changed data and
prompts the user to save their work. This function does not change
the behavior of this feature in any way. It simply makes sure that
the name property of the controls that have no changes are retained.
In this way, this function differs from yfcDoNotPromptForChanges().

Syntax

ignoreChangeNames()

Input parameters

None.

Return value

None.

Example

The
example attaches this function to the onload event.

 
window.attachEvent("onload", IgnoreChangeNames); 

InvokeCalendar

You can review the details about the invokeCalendar JavaScript function. This JavaScript function invokes the calendar lookup.

Description

The invokeCalendar function assumes that the previous object to the one passed (in the DOM
hierarchy of the HTML) is the one that must be populated with the date selected in the lookup.

Note: International
calendar formats are supported.

Syntax

invokeCalendar(obj)

Input parameters

obj – Required. Handle to the image object
that was selected to invoke the calendar.

Output parameters

None.

Example

This
example shows how the Calendar Lookup is invoked from the Horizon
End Date field in the Inventory detail view.

 <td class="detaillabel" ><yfc:i18n>Horizon_End_Date</yfc:i18n></td>
 <td class="protectedtext" nowrap="true">
       <input type="text" class="dateinput" onkeydown="return 
checkKeyPress(event)" 
<%=getTextOptions("xml:/InventoryInformation/Item/@EndDate","xml:
/InventoryInformation/Item/@EndDate","")%> />
    <img class="lookupicon"  onclick="invokeCalendar(this);return false"  
<%=getImageOptions(YFSUIBackendConsts.DATE_LOOKUP_ICON,"View_Calendar")%>/>
    <input type="button" class="button" value="GO" 
onclick="if(validateControlValues())changeDetailView(getCurrentViewId())"/>
 </td>

InvokeTimeLookup

You can review the details invokeTimeLookup JavaScript function. This JavaScript function
invokes the time lookup.

Description

The invokeTimeLookup function assumes that the previous object to the one passed (in the DOM
hierarchy of the HTML) is the one that must be populated with the date selected in the lookup.

Syntax

invokeTimeLookup(obj)

Input parameters

obj – handle to the image object that
was clicked to invoke the calendar.

Output parameters

None.

Example

This
example shows how the time lookup is used in a date and time search
criteria field.

<tr>
  <td nowrap="true">
     <input class="dateinput" type="text" 
<%=getTextOptions("xml:/Shipment/@FromExpectedShipmentDate_YFCDATE")%>/>
		   <img class="lookupicon" name="search" onclick="invokeCalendar(this);
return false"
<%=getImageOptions(YFSUIBackendConsts.DATE_LOOKUP_ICON, "Calendar") %> />
     <input class="dateinput" type="text" 
<%=getTextOptions("xml:/Shipment/@FromExpectedShipmentDate_YFCTIME")%>/>
    	<img class="lookupicon" name="search" 
onclick="invokeTimeLookup(this);return false" 
<%=getImageOptions(YFSUIBackendConsts.TIME_LOOKUP_ICON,"Time_Lookup") %> />
	    <yfc:i18n>To</yfc:i18n>
  </td> 
</tr> 
<tr>
  <td>
   	<input class="dateinput" type="text" 
<%=getTextOptions("xml:/Shipment/@ToExpectedShipmentDate_YFCDATE")%>/>
    	<img class="lookupicon" name="search" onclick="invokeCalendar(this);
return false"
<%=getImageOptions(YFSUIBackendConsts.DATE_LOOKUP_ICON, "Calendar") %> />
		   <input class="dateinput" type="text" 
<%=getTextOptions("xml:/Shipment/@ToExpectedShipmentDate_YFCTIME")%>/>
    	<img class="lookupicon" name="search" 
onclick="invokeTimeLookup(this);return false" 
     		<%=getImageOptions(YFSUIBackendConsts.TIME_LOOKUP_ICON,
"Time_Lookup") %>/>
   </td> 
</tr>

ShowDetailFor

You can review the details about the showDetailFor JavaScript function, which changes the page to show the default view of the current
entity.

Description

This JavaScript function changes
the current page to show the default view of the current entity. The
resulting screen opens in the same browser window, not in a new window.
You typically use the showDetailFor() function to move from the list
view to the detail view. Then after the detail view opens, this function
is not used, because subsequent views are typically invoked as pop-up
windows and this function does not do that.

If you do choose
to use this function in a detail screen, the following behavior must
be kept in mind. This function does a [get] and not a [post]. Therefore,
if you see the Next or Previous icons on your screen and you use this
function to switch to the default view, the icons are lost. The icons
disappear because the hidden input in the current page that contain
information regarding the Next or Previous views are lost when this
function does a [get].

In a list screen, this function is used
in conjunction with the yfc:makeXMLInput JSP tag. The makeXMLInput
JSP tag prepares an XML containing the key attributes. That XML must
be passed to the default detail view.

Syntax

showDetailFor(entityKey)

Input parameters

entityKey – Required. String containing
a URL-encoded XML that contains the key attributes required by the
detail view.

Output parameters

None.

Example

This
example shows an Order list view that contains two columns: Order
Number and Enterprise Code. Order Number is hyperlinked to open the
default detail view of Order. Notice that yfc:makeXMLInput prepares
an XML that is later used as the input parameter to the showDetailFor()
function by using the getParameter() JSP function.

<table class="table" editable="false" width="100%" cellspacing="0">
  <thead> 
    <tr>
       <td sortable="no" class="checkboxheader">
         <input type="checkbox" name="checkbox" value="checkbox"
onclick="doCheckAll(this);"/>
        </td>
        <td class="tablecolumnheader"><yfc:i18n>Order_#</yfc:i18n></td> 
        <td class="tablecolumnheader"><yfc:i18n>Enterprise</yfc:i18n></td>
    </tr>
  </thead>
  <tbody>
    <yfc:loopXML binding="xml:/OrderList/@Order" id="Order">
      <tr>
         <yfc:makeXMLInput name="orderKey">
               <yfc:makeXMLKey binding="xml:/Order/@OrderHeaderKey" 
value="xml:/Order/@OrderHeaderKey" />
         </yfc:makeXMLInput>
         <td class="checkboxcolumn"> 
             <input type="checkbox" value='<%=getParameter("orderKey")%>'
name="EntityKey"/>
         </td>
         <td class="tablecolumn"><a 
href="javascript:showDetailFor('<%=getParameter("orderKey")%>');">
             <yfc:getXMLValue binding="xml:/Order/@OrderNo"/></a>
          </td>
          <td class="tablecolumn"><yfc:getXMLValue 
binding="xml:/Order/@EnterpriseCode"/></td>
      </tr>
    </yfc:loopXML>
  </tbody> 
</table>

ShowDetailForViewGroupId

You can review the details about the showDetailForViewGroupId JavaScript function.

Description

This JavaScript function changes
the current page to show the default view of the given View Group
ID (The View ID with the least Resource Sequence number is the default
view for a particular View Group Id). The resulting screen opens in
the same browser window. Use the showDetailForViewGroupId()function
to move from the list view to the detail view. When the detail view
opens, this function is not used, because subsequent views are invoked
as pop-up windows and this function does not do that.

In the
list screen, this function is used in conjunction with the yfc:makeXMLInput
JSP tag. The makeXMLInput JSP tag creates an XML containing the key
attributes. That XML must be passed to the default detail view.

Syntax

showDetailForViewGroupId
(entityname, viewGroupId, entityKey, extraParameters)

Input parameters

entityName – Required. Entity to search
in the detail screen.

viewGroupId – Required. The view
group ID shown to the user.

entityKey – Required. String
containing a URL-encoded XML that contains key attributes required
by the detail view.

Output parameters

None.

Example

<td class="tablecolumn">
   <a href = "javascript:showDetailForViewGroupId
('load','YDMD200','<%=getParameter("loadKey")%>');"> 
<yfc:getXMLValue binding="xml:/Load/@LoadNo"/>
   </a> 
</td>

ShowPopupDetailFor

You can review the details about the showPopupDetailFor JavaScript function.

Description

This JavaScript function shows
the default view of the current entity in a pop-up window (modal dialog).
It is a blocking call. It does not return until the modal dialog is
closed.

Syntax

showPopupDetailFor(key,
name, width, height, argument)

Input parameters

key – Required. Entity key that is required
by the detail view. If not passed, the current entity’s key is automatically
passed to the pop-up window.

name – Required. Pass as
blank space (” “). Not used.

width – Required. Horizontal
size of the pop-up window. Measured in pixels. If passed as 0, a certain
default width is used.

height – Required. Vertical size
of the pop-up window. Measured in pixels. If passed as 0, a certain
default height is used.

argument – Required. Anything
passed in this field is available in the modal dialog through the
window.dialogArguments attribute.

Returns

None.

Example

This
example shows how the inventory audit detail is invoked from the inventory
audit list screen.

The same list screen is used in a list view,
as well as in a detail pop-up window. When you select the transaction
date, if the current screen is a pop-up window, another pop-up window
is invoked with the audit details. If the current view is list view,
the audit detail screen comes up in the same window.

<tbody>
  <yfc:loopXML name="InventoryAudits" 
binding="xml:/InventoryAudits/@InventoryAudit" id="InventoryAudit"> 
    <tr> 
      <yfc:makeXMLInput name="inventoryAuditKey">
        <yfc:makeXMLKey binding="xml:/InventoryAudit/@InventoryAuditKey" 
value="xml:/InventoryAudit/@InventoryAuditKey" />
        <yfc:makeXMLKey binding="xml:/InventoryAudit/@OrganizationCode" 
value="xml:/InventoryAudit/@InventoryOrganizationCode" />
      </yfc:makeXMLInput>
      <td class="checkboxcolumn">
         <input type="checkbox" value='<%=getParameter("inventoryAuditKey")%>' name="EntityKey"/>
      </td>
      <td class="tablecolumn"
sortValue="<%=getDateValue("xml:/InventoryAudit/@Modifyts")%>">
        <%if ( "Y".equals(request.getParameter
(YFCUIBackendConsts.YFC_IN_POPUP)) ) {%>
            <a href="" 
onClick="showPopupDetailFor('<%=getParameter("inventoryAuditKey")%>',
'','900','550',window.dialogArguments);return false;" >
               <yfc:getXMLValue name="InventoryAudit" 
binding="xml:/InventoryAudit/@Modifyts"/>
            </a>
         <%} else {%>
            <a 
href="javascript:showDetailFor('<%=getParameter("inventoryAuditKey")%>');">
               <yfc:getXMLValue name="InventoryAudit" 
binding="xml:/InventoryAudit/@Modifyts"/>
             </a>
         <%}%> 
       </td>
       <td class="tablecolumn">
           <yfc:getXMLValue name="InventoryAudit" 
binding="xml:/InventoryAudit/@ItemID"/>
 
       </td>
       <td class="tablecolumn">
           <yfc:getXMLValue 
name="InventoryAudit" binding="xml:/InventoryAudit/@ProductClass"/>
       </td>
       <td class="tablecolumn">
           <yfc:getXMLValue 
name="InventoryAudit" binding="xml:/InventoryAudit/@UnitOfMeasure"/>
       </td>
       <td class="tablecolumn">
           <yfc:getXMLValue 
name="InventoryAudit" binding="xml:/InventoryAudit/@TransactionType"/>
       </td>
        <td class="tablecolumn">
           <yfc:getXMLValue 
name="InventoryAudit" binding="xml:/InventoryAudit/@ShipNode"/>
       </td>
    </tr>
   </yfc:loopXML> 
</tbody>

ValidateControlValues

Description

This JavaScript function checks
for client-side validation errors. When the user enters invalid data
in an input field, the Presentation Framework flags the field as in
error. When the user submits data in the page, this function should
be called to make sure that invalid data is not posted.

Syntax

validateControlValues()

Input parameters

None.

Return values

true – No errors were found.

false
One or more errors were found.

Example

This
example shows how to check for errors before you submit the current
page.

<td class="detaillabel" ><yfc:i18n>Horizon_End_Date</yfc:i18n></td> 
<td class="protectedtext" nowrap="true">
  <input type="text" class="dateinput" onkeydown="return checkKeyPress(event)" 
<%=getTextOptions("xml:/InventoryInformation/Item/@EndDate",
"xml:/InventoryInformation/Item/@EndDate","")%> />
  <img class="lookupicon"  onclick="invokeCalendar(this);return false"
<%=getImageOptions(YFSUIBackendConsts.DATE_LOOKUP_ICON,"View_Calendar")%> />
  <input type="button" class="button" value="GO" 
onclick="if(validateControlValues())changeDetailView(getCurrentViewId())"/> 
</td>

YfcAllowSingleSelection

Description

Some
operations can be performed on only one record at a time. However,
the user interface typically permits multiple options to be checked
before an operation is selected. Therefore, the operations that do
not support multiple selections must themselves validate that not
more than one record has been selected for processing. This function
does that validation.

Syntax

yfcAllowSingleSelection(chkName)

Input parameters

chkName – Optional.
Name of the set of checkbox controls, one of which must be checked
before an operation is performed. If the value is not passed or is
blanks, it defaults to EntityKey.

Output parameters

true – Zero or one record was selected.

false
More than one record was selected.

Examples

Receiving
intransit updates can only be done one stop at a time. Therefore,
the operation for receiving intransit updates is configured to first
call the JavaScript function
yfcAllowSingleSelection() and then to invoke the receiveIntransitUpdates()
API.

This example performs an action if one, and only one, selection
was made for checkboxes that have the name set to the value passed
in the sKeyName variable.

function goToOrderLineSchedules(sSearchViewID, sKeyName, bPopup) 
{
	 if(yfcAllowSingleSelection(sKeyName))
 	{
   		…
  	}
 }

YfcBodyOnLoad

Description

This JavaScript function is called
whenever any page is loaded. Typically, it is automatically called
when the page is loaded. However, if your page must do something special
on the onload event, you can call this function first and then call
your own window.onload() function.

Syntax

yfcBodyOnLoad()

Input parameters

None.

Return value

None.

Example

This
example shows how the onload event can be taken by your custom JSP
rather than let the Presentation Framework take it.

function window.onload()					{
    if (!yfcBodyOnLoad()
&& (!document.all('YFCDetailError'))) {
     return;
    }
//Do your special processing here 
}

YfcChangeDetailView

Description

This JavaScript function switches
to a specific detail view. This function uses the POST function to
switch the view.

Syntax

yfcChangeDetailView(viewID)

Input parameters

viewID – Required.
Resource ID of the detail view to which you wish to switch.

Return values

None.

Example

This
example shows how to use the yfcChangeDetailView() function in order
charges and the taxes summary in order to refresh the page to the
current view when a combobox value is changed.

<select name="chargeType" class="combobox" 
onchange="yfcChangeDetailView(getCurrentViewId());">
  <option value="Overall" <%if (equals(chargeType,"Overall")) {%> selected 
<%}%>><yfc:i18n>Ordered</yfc:i18n></option>
  <option value="Remaining" <%if (equals(chargeType,"Remaining")) {%> selected 
<%}%>><yfc:i18n>Open</yfc:i18n></option>
  <option value="Invoiced" <%if (equals(chargeType,"Invoiced")) {%> selected 
<%}%>><yfc:i18n>Invoiced</yfc:i18n></option> 
</select>

YfcChangeListView

Description

This JavaScript function switches
the current view to a list view. The list view is expected to have
a pre-determined filter criteria, since this function does not accept
any additional filter criteria.

Syntax

function
yfcChangeListView(entity, searchViewId,maxrecords)

Input parameters

entity – Required.
Entity to which the searchViewId belongs.

searchViewId
Required. Identifier of the search view to which you wish to switch.

maxrecords
Optional. Maximum number of records to display in the list view. To
enhance performance, use this parameter. If this is not passed, it
defaults to the value specified in the yfs.properties file.

Note: Use the INSTALL_DIR/properties/customer_overrides.properties
file to set the yfs.ui.MaxRecords property.

Output parameters

None.

Example

The
home page shows a list of alerts, up to a certain number, that has
been set as the maximum number to display. To see a complete list
of all alerts, the user can select the More Alerts operation. This
operation is configured to call the yfcChangeListView() JavaScript function.

YfcDisplayOnlySelectedLines

Description

This JavaScript function is for
situations when the user needs to select multiple records from a list
in screen A and those records must be passed on to screen B. In screen
B, the selected records are displayed, possibly with additional information
for each record. In such cases, the logic is that the same set of
APIs that were used to build screen A could be called to also build
screen B, and on the client side, a filtration process limits the
display to only those selected in screen A.

This function requires
that each row in the table that is under consideration must have an
attribute called yfcSelectionKey set to the URL encoded XML (formed
using yfc:makeXMLInput JSP tag).

Syntax

yfcDisplayOnlySelectedLines(tableId)

Input parameters

tableId – Required. Identifier attribute
of the table whose content must be limited to that selected from the
previous screen.

Output parameters

None.

Example

The
following example shows how the create order line dependency screen
limits the results in the order lines list to the specific lines that
are selected in the order detail screen. First, this function must
be called in the onload event.


   function window.onload() {
     if (!yfcBodyOnLoad() && (!document.all('YFCDetailError'))) {
          return;
     }
     yfcDisplayOnlySelectedLines("DependentLines");
   } 

Second, each <tr> tag must
contain the yfcSelectionKey attribute.

<tbody>
    <yfc:loopXML name="Order" 
binding="xml:/Order/OrderLines/@OrderLine" id="OrderLine">
      <yfc:makeXMLInput name="orderLineKey">
      <yfc:makeXMLKey binding="xml:/OrderLineDetail/@OrderLineKey" 
value="xml:/OrderLine/@OrderLineKey"/>
      <yfc:makeXMLKey binding="xml:/OrderLineDetail/@OrderHeaderKey" 
value="xml:/Order/@OrderHeaderKey"/>
     </yfc:makeXMLInput>
     <tr yfcSelectionKey="<%=getParameter("orderLineKey")%>">
          <td class="tablecolumn"><yfc:getXMLValue
binding="xml:/OrderLine/Item/@ItemID"/></td>
          <td class="tablecolumn"><yfc:getXMLValue
binding="xml:/OrderLine/Item/@ProductClass"/></td>
          <td class="tablecolumn"><yfc:getXMLValue
binding="xml:/OrderLine/Item/@UnitOfMeasure"/></td>
          <td class="tablecolumn"><yfc:getXMLValue
binding="xml:/OrderLine/Item/@ItemDesc"/></td>
     </tr>
     </yfc:loopXML>            
 </tbody>

YfcDoNotPromptForChanges

Description

This JavaScript function turns
off the automatic prompts that remind the user to save changes to
their data. By default on any screen, if a user enters data and then
starts to navigate away without saving the data, the Presentation
Framework catches this and alerts the user to save their data.

When
you call this function it sets a parameter on the window object. This
parameter is checked during the onunload event and if the parameter
is set through this function, the user is not warned.

When
you call this function to turn off prompting, all data in the screen
is passed to the API during save.

This JavaScript function does not turn off
the prompts that remind a user to save changes to their data when
executing inner panel actions.

If you call an API on an inner
panel and do not want the user to be prompted to save changes, you
must also use either the yfcSetControlAsUnchanged or the yfcDoNotPromptForChangesForActions
function.

Syntax

yfcDoNotPromptForChanges(value)

Input parameters

value – Required.
Determines whether or not the user should be prompted to save any
new data they have input that has not yet been saved. Valid values
are true and false. If specified as true, the user is not prompted
to save. If specified as false, the user is prompted to save the data.

Return value

None.

Example

This
example shows how this function turns off the automatic prompts for
the manifest detail screen.


yfcDoNotPromptForChanges(true);
 

YfcDoNotPromptForChangesForActions

Description

This JavaScript function can be
used when you want to skip the “Changes made to the current screen
will be lost” validation that is done when the user clicks actions
on an inner panel. Normally, inner panel actions in the Application
Console are not used with the editable fields on a screen. Therefore,
when the user changes an input field and clicks an action, the warning
message is displayed by default. Call this JavaScript method to avoid this validation.
You can call this method for all actions on a view by calling it in
your JSP in a script tag. Alternatively, you can call this method
for a specific action by calling it as part of the JavaScript property of the action resource.

Syntax

yfcDoNotPromptForChangesForActions(value)

Input parameters

value – Required. Pass true to
skip the changes made validation. Pass false to
turn the validation on. By default, the validation is on.

Return value

None.

Example

This
example shows how to call the yfcDoNotPromptForChangesForActions function
from a JSP to turn the “changes made” validation off for all actions
on the view:

 
      yfcDoNotPromptForChangesForActions(true); 

YfcGetCurrentStyleSheet

Description

This JavaScript function retrieves
name of the style sheet for the current window.

Syntax

yfcGetCurrentStyleSheet()

Input parameters

None.

Output parameters

currentStyleSheet – The name of the style
sheet for the current window. The full name of the style sheet is
returned, including the file extension (for example, sapphire.css).

Example

This
example shows how to get the current style sheet of the window.

var currentStyleSheet = yfcGetCurrentStyleSheet();

YfcGetSaveSearchHandle

Description

This JavaScript function provides
a handle to the Save Search icon on the search view. This handle then
can be used for attaching events to achieve custom behavior. To change
the behavior associated with the Search icon, see “yfcGetSearchHandle.”

Syntax

var
oObj=yfcGetSaveSearchHandle();

Input parameters

None.

Output parameters

var – Handle to the Save Search icon on
the search view.

Example

This
example shows how to have the application perform custom processing
when the user selects the Save Search icon.


	function attachBehaviorFn()
	{
       ...
		var oObj1=yfcGetSaveSearchHandle();
		var sVal1=oObj1.attachEvent("onclick",fixDerivedFromReturnSearch);
	}
   window.attachEvent("onload",attachBehaviourFn); 
...

YfcGetSearchHandle

Description

This JavaScript function provides
a handle to the Search icon on a search view. This handle then can
be used for attaching events in order to achieve custom behavior.
To affect the behavior associated with the Save Search icon, see “yfcGetSaveSearchHandle.”

Syntax

var
oObj=yfcGetSearchHandle();

Input parameters

None.

Output parameters

var – Handle to the Search icon on the
search view.

Example

This
example shows how to have the application perform custom processing
when the user selects the Search icon.


	function attachBehaviourFn()
	{
		var
oObj=yfcGetSearchHandle();
		var sVal=oObj.attachEvent("onclick",fixDerivedFromReturnSearch);
       ...
 	}
    window.attachEvent("onload",attachBehaviourFn); 
...

YfcHasControlChanged

Description

This JavaScript function determines
if the contents of a specific control have been modified by the user
since the page loaded.

This is accomplished by comparing the
current value of a specific control with the custom attribute OldValue
stored in the control when the page is loaded.

In the case of
checkboxes and radio buttons, the custom attribute is oldchecked.

Syntax

yfcHasControlChanged(ctrl)

Input parameters

ctrl – Required. Object in the HTML object
hierarchy.

Return values

true – Value of the specified control is different
from when the page was first loaded.

false – Value of
the specified control is the same as when the page was first loaded.

Example

This
example shows how the Order Modification Reasons pop-up window uses
this function to set the Override Flag in a hidden field.

The
hidden field is passed to the changeOrder() API only when a specific
field (for example, requested ship date) that is permitted to be changed
only by users with special override permissions is changed by the
user. This function detects if any of the input in the screen has
changed.

function setOverrideFlag(overrideFlagBinding) {
    var overrideFlagInput=document.all(overrideFlagBinding);
    var docInputs=document.getElementsByTagName("input");
    for (var i=0;iyfcHasControlChanged(docInput)) {
               overrideFlagInput.value="Y";
               return;
            }
       }
    }
    var docSelects=document.getElementsByTagName("select");
    for (var i=0;iyfcHasControlChanged(docSelect)) {
               overrideFlagInput.value="Y";
               return;
            }
       }
    } 
}

YfcMultiSelectToSingleAPIOnAction

Description

This JavaScript function replaces
the yfcMultiSelectToSingleAPI() JavaScript function,
which has been deprecated.

This function makes a single API
call using multiple selections in a list. By default, when an action
that calls an API on a list screen is run while multiple selections
have been made by the user, the API runs once for each selected record.
This function enables you to configure an action that calls an API
that runs only once for all selected records.

Attach this function
to the action resource. This function creates hidden inputs on the
list screen for each record that the user selects. Assuming that the
input namespace of the action has been defined correctly, the API
is called once and all selected records are passed.

Syntax

yfcMultiSelectToSingleAPIOnAction(checkBoxName,
counterAttrName, valueAttrName, keyAttributeName, parentNodePrefix,
parentNodePostfix)

Input parameters

checkBoxName – Required. Name of the checkbox
object within the JSP where the action is defined.

counterAttrName
Required. Name of the HTML attribute on the checkbox object that contains
the counter value that uniquely identifies this row within the table.
It is recommended that you always use the string yfcMultiSelectCounter
for this parameter.

valueAttrName – Required. Name of
the HTML attribute on the checkbox object that contains the value
that should be set into the attribute passed in the keyAttributeName
parameter. It is recommended that you prefix the value with the yfcMultiSelectValue
string. For more details, see the example.

keyAttributeName
Required. Name of the attribute that should be passed to the API.

parentNodePrefix
Required. The portion of the XML binding up to and including the repeating
XML element that is to be passed as input to the API.

parentNodePostfix
Optional. The portion of the XML binding between the repeating XML
elements of the API input up to the final element in which the attribute
specified in the keyAttributeName parameter is to be passed.

Output parameters

None.

Example

This
example shows a Create Shipment action that has been defined on a
Order Release list view. The following shows how the checkbox object
is created within the JSP:

checkbox" 
value='' name="EntityKey" 
yfcMultiSelectCounter='' 
yfcMultiSelectValue1='' 
yfcMultiSelectValue2='Add'/> 

Additionally, the Create Shipment action
has the JavaScript field
set to the following:

yfcMultiSelectToSingleAPIOnAction('EntityKey', 'yfcMultiSelectCounter', 
'yfcMultiSelectValue1', 'OrderReleaseKey', 
'xml:/Shipment/OrderReleases/OrderRelease', 
null);yfcMultiSelectToSingleAPIOnAction('EntityKey', 'yfcMultiSelectCounter', 
'yfcMultiSelectValue2', 'AssociationAction',
'xml:/Shipment/OrderReleases/OrderRelease', null);

Note
that the yfcMultiSelectToSingleAPIOnAction function is called twice
to create two hidden inputs required by the API.

YfcSetControlAsUnchanged

Description

This JavaScript function eliminates
prompting the user to save data when controls are placed on an inner
panel. Achieves this by setting controls as “not changed.” The something
function sets the prompt “Changes made to the data on screen will
be lost” from appearing.

After configuring
all controls on a page to use this function, call this function for
each control on a page before invoking an action.

If an inner
panel uses an Action and has modifiable controls that take input required
for the Action, you can use this function to prevent the “Changes
made to the data on screen will be lost” message.

When using
this function, you must also call the yfcDoNotPromptForChanges() function
in the JSP containing the Action.

Syntax

yfcSetControlAsUnchanged
(control)

Input
parameters

control – Required. Object in the HTML
object hierarchy.

Return
value

None.

Example

This
example shows how to call the CallSetControl() function from Action:

 yfcDoNotPromptForChanges(true)  
 
function CallSetControl() {
 var myControl=document.all("xml:/InventoryItem/SKU/@OldSKU");
 var myControl_1=document.all("xml:/InventoryItem/SKU/@NewSKU");
 var myControl_2=document.all("xml:/InventoryItem/@EMailID");
 yfcSetControlAsUnchanged(myControl);
 yfcSetControlAsUnchanged(myControl_1);
 yfcSetControlAsUnchanged(myControl_2);
 return(true);
 }
 

YfcShowDefaultDetailPopupForEntity

Description

This JavaScript function shows
the default detail view of an entity in a pop-up window (modal dialog).
The entity for which the view is displayed must be specified in the
yfsTargetEntity attribute of the checkbox object whose name is passed
as input. It is a blocking call. It does not return until the modal
dialog is closed.

Syntax

yfcShowDefaultDetailPopupForEntity(checkBoxName)

Input parameters

checkBoxName – Required.
Name of one or more checkbox objects with the yfsTargetEntity attribute
containing the ID of the entity for which the default detail view
is to be displayed.

Return values

None.

Example

This
example shows how a view details action on an Order List screen could
use this function to bring up the default detail view of the order
entity.

JSP code for the checkbox:

<td class="checkboxcolumn"> 
<input type="checkbox" value='<%=getParameter("orderKey")%>' 
name="chkRelatedKey" yfsTargetEntity="order"/> 
</td>

The view details action should be defined with
these properties:

ID=“<Some ID>” 
Name="View_Details" 
Javascript="showDefaultDetailPopupForEntity('chkRelatedKey')" 
Selection Key Name="chkRelatedKey"

YfcShowDetailPopup

Description

This JavaScript function shows
a specific view ID in a pop-up window, which is modal. It is a blocking
call; it does not return until the modal dialog box is closed.

Syntax

yfcShowDetailPopup(viewID,
name, width, height, argument, entity, key)

Input parameters

viewID – Required. Resource ID of the
detail view to be shown as a pop-up window. If passed as an empty
string, the pop-up window displays the default detail view of the
entity specified in the entity parameter.

name – Required.
Pass as blank space (” “). Not used.

width – Required.
Horizontal size of the pop-up window. Measured in pixels. If passed
as 0, a certain default width is used.

height – Required.
Vertical size of the pop-up window. Measured in pixels. If passed
as 0, a certain default height is used.

argument – Required.
Anything passed in this field is available in the modal dialog through
the window.dialogArguments attribute.

entity – Optional.
The entity of the detail view that is to be opened. If not passed,
defaults to the same entity of the view that is currently being displayed.

key
Optional. Entity key that is required by the detail view. If not passed,
the key of the current entity is passed to pop-up window.

Return values

None.

Example

This
example shows how the Modification Reason Code pop-up window displays
when Save is selected on the Order Detail screen.

function enterActionModificationReason(modReasonViewID, modReasonCodeBinding, 
modReasonTextBinding) {
    var myObject=new Object();
    myObject.currentWindow=window;
    myObject.reasonCodeInput=document.all(modReasonCodeBinding);
    myObject.reasonTextInput=document.all(modReasonTextBinding);
    // If the current screen has a hidden input for draft order flag
    // and the value of the input is "Y", don't show the modification
    // reason window.
    var draftOrderInput=document.all("hiddenDraftOrderFlag");
    if (draftOrderInput != null) {
        if ("Y" == draftOrderInput.value) {
           return (true);
        }
   }
    yfcShowDetailPopup(modReasonViewID, "", "550", "255", myObject);
  
    if (getOKClickedAttribute() == "true") {
       window.document.documentElement.setAttribute("OKClicked", "false");
       return (true);
    }
    else {
       window.document.documentElement.setAttribute("OKClicked", "false");
       return (false);
    }
}

YfcShowDetailPopupWithDynamicKey

Description

When
called with a specific object (in the HTML object hierarchy this JavaScript function prepares
a URL-encoded XML containing all the values under the object (recursively).
Only the values to be posted are considered. The XML then is passed
on to a pop-up window as a parameter to show the specified view.

Syntax

yfcShowDetailPopupWithDynamicKey(obj,
view, entity, inputNodeName, winObj)

Input parameters

obj – Required.
Handle to the object based on which the key is dynamically prepared.
For the specific object, this function traverses up the HTML hierarchy
to find the nearest <table> tag. From that <table> tag,
this function then searches for all input and checkboxes. Based on
the binding for these controls, a URL encoded XML is formed which
is then passed as the entity key to the detail view being invoked.

viewID
Required. Resource ID of the detail view to be shown as a pop-up window.
If passed as an empty string, the default detail view of the specified
entity is shown in the pop-up window.

entity – Optional.
Resource ID of the entity of the detail view to be shown. If not passed,
defaults to the current entity.

inputNodeName – Required.
Root node name of the XML to be prepared to be passed to the detail
view.

winObj – Optional. Anything passed in this field
becomes available in the modal dialog through the window.dialogArguments
attribute. If this parameter is not passed, an empty object is passed
to the pop-up window.

Return
value

None.

Example

This
example shows how to use this function to invoke list of order lines
that can be added to a return. The list of order lines requires an
order number to be specified, but this number is editable by the user.
Hence, the input cannot be formed on the server side through a makeXMLInput
JSP tag. Therefore, the input is prepared on the client side using
this function. The following example contains a doClick() function
that must be configured to be called when you select a Proceed icon
as doClick(this). This way, the button object itself is passed as
a parameter to the doClick() function. For this to work, the button
object must be in the same <table> tag that contains the order
number input box.

function doClick(obj) {
  yfcShowDetailPopupWithDynamicKey(obj, 'YOMD2002', 'return', 
'Order',new Object()); 
}

YfcShowDetailPopupWithKeys

Description

This JavaScript functions shows
a specific view ID in a pop-up window (modal dialog). It is a blocking
call. It does not return until the modal dialog is closed.

Use
this function in situations where the default key generated by the
Presentation Framework to be passed on the detail view is not accepted
by the detail view being invoked.

Syntax

yfcShowDetailPopupWithKeys(viewID,
name, width, height, argument, keyName, entity, selectionKeyName)

Input parameters

viewID – Required.
Resource ID of the detail view to be shown as a pop-up window. If
passed as an empty string, the default detail view of the specified
entity is displayed.

name – Required. Pass as blank
space (” “). Not used.

width – Required. Horizontal
size of the pop-up window. Measured in pixels. If passed as 0, a certain
default width is used.

height – Required. Vertical size
of the pop-up window. Measured in pixels. If passed as 0, a certain
default height is used.

argument – Optional. Passed as
the argument parameter to the showModalDialog() function that is used
to show the pop-up window. This then becomes available in the modal
dialog through the window.dialogArguments attribute. If not passed,
a new Object is created and passed to the pop-up window.

keyName
Required. Name attribute of a control that contains the Entity Key
that is required by the detail view. If it is not passed, defaults
to the value EntityKey.

entity – Optional. Resource ID
for the detail view being shown. If not passed, defaults to the current
entity.

selectionKeyName – Optional. Name of the checkbox
control that must be checked by the user before the pop-up window
is invoked. If this name is not passed (or is passed as null), the
check is not performed, and the pop-up window is invoked immediately.

Return value

None.

Example

This
example shows how to invoke the modify address dialog from an inner
panel that specifies its own entity key.

function doModifyAddressDialogWithKeys(source, viewID, entityKeyName)	{		
   var myObject=new Object();
   myObject.currentwindow=window;
   myObject.currentsource=source;
   if(viewID == null) {
      viewID="YADD001";
   }
    if (entityKeyName == null) {
        entityKeyName="EntityKey";
    }
    yfcShowDetailPopupWithKeys(viewID, "", "600", "425", myObject,
entityKeyName); 
}

YfcShowDetailPopupWithKeysAndParams

Description

This JavaScript function invokes
a specified detail view within a modal dialog. You can pass parameters
to the detail view by forming a string in the format of name1=value1&name2=value2 and
passing this string as a parameter to this function.

This function
appends the passed string to the URL that is used to invoke the view.
Thus, the passed parameters are available in the request object to
the called view.

Use this function in situations where the default
key generated by the Presentation Framework to be passed on the detail
view is not accepted by the detail view being invoked.

Syntax

yfcShowDetailPopupWithKeysAndParams(viewID,
name, width, height, argument,keyName, entity, selectionKeyName, params)

Input parameters

viewID – Required.
Resource ID of the detail view to be shown as a pop-up window. If
passed as an empty string, the default detail view of the specified
entity is displayed.

name – Required. Pass as blank
space (” “). Not used.

width – Required. Horizontal
size of the pop-up window. Measured in pixels. If passed as 0, a certain
default width is used.

height – Required. Vertical size
of the pop-up window. Measured in pixels. If passed as 0, a certain
default height is used.

argument – Optional. Passed as
the argument parameter to the showModalDialog() function that is used
to show the pop-up window. This then becomes available in the modal
dialog through the window.dialogArguments attribute. If not passed,
a new Object is created and passed to the pop-up window.

keyName
Required. Name attribute of a control that contains the Entity Key
that is required by the detail view. If it is not passed, defaults
to the value EntityKey.

entity – Optional.
Resource ID for the detail view being shown. If not passed, defaults
to the current entity.

selectionKeyName – Optional.
Name of the checkbox control that must be checked by the user before
the pop-up window is invoked. If this name is not passed (or is passed
as null), the check is not performed, and the pop-up window is invoked
immediately.

params – Required. String containing parameters
to be passed to the detail view being invoked. Use the syntax name1=value1&name2=value2.
This appends the string to the URL invoking the detail view which
enables the parameters to be available to the detail view of the requested
object.

Return value

None.

Example

This
example opens a custom detail page and passes some custom parameters
to it.

yfcShowDetailPopupWithKeysAndParams('CSTOrder012','',800,600,new
Object(),'EntityKey','order','EntityKey',
'CustParam1=xml:/Order&CustParam2=process')

YfcShowDetailPopupWithParams

Description

This JavaScript function invokes
a specified detail view within a modal dialog. You can pass parameters
to the detail view by forming a string in the format of name1=value1&name2=value2 and
passing this string as a parameter to this function.

This function
appends the passed string to the URL that is used to invoke the view.
Thus, the passed parameters are available in the request object to
the called view.

Syntax

yfcShowDetailPopupWithParams(viewID,name,width,height,params,entity,key,
argument)

Input parameters

viewID – Required.
Resource ID of the detail view to be shown as a pop-up window. If
passed as empty string, the default detail view of the specified entity
is displayed.

name – Required. Not used. However an empty
string must be passed.

width – Required. Horizontal
size of the pop-up window. Measured in pixels. If passed as 0, a certain
default width is used.

height – Required. Vertical size
of the pop-up window. Measured in pixels. If passed as 0, a certain
default width is used.

params – Required. String containing
parameters to be passed to the detail view being invoked. Use the
syntax name1=value1&name2=value2. This appends
the string to the URL invoking the detail view which enables the parameters
to be available to the detail view of the requested object.

entity
Optional. Resource ID corresponding the detail view. If not passed,
defaults to the current entity.

key – Optional. Value
of the key to be passed as a parameter to the detail view. If not
passed, the current view’s key is passed to the detail view being
invoked.

argument – Optional. Passed as the argument
parameter to the showModalDialog() function that is used to show the
pop-up window. This then becomes available in the modal dialog through
the window.dialogArguments attribute. If this is not passed, an empty
object is passed to the modal dialog.

Return value

None.

Example

This
example shows how the notes pop-up window is displayed using this
function. The notes pop-up window detail view requires certain parameters
to be passed to it. For instance, an XML binding pointing to attributes
that control if notes are editable for the current order status or
not. To accomplish this, the following example forms a string containing
these parameters and invokes this JavaScript function.

var 
extraParams="allowedBinding=xml:/Order/AllowedModification&getBinding=xml:
/Order&saveBinding=xml:/Order"; 
yfcShowDetailPopupWithParams('YOMD020', '', "800", "600", extraParams);

YfcShowListPopupWithParams

Description

This JavaScript function shows
a specified list view in a pop-up window (modal dialog). This is a
blocking call. The function does not return until the window is closed.

Syntax

yfcShowListPopupWithParams(viewID,
name, width, height, argument, entity, params)

Input parameters

viewID – Required. Resource ID of the
list view to be shown as a pop-up window. If passed as an empty string,
the default list view of the specified entity is displayed.

name
Required. Pass as a blank space (” “). Not used.

width
Required. Horizontal size of the pop-up window. Measured in pixels.
If passed as 0, a certain default width is used.

height
Required. Vertical size of the pop-up window. Measured in pixels.
If passed as 0, a certain default height is used.

argument
Required. Value passed as the argument parameter to showModalDialog()
function that is used to show the pop-up window. This then becomes
available in the modal dialog through the window.dialogArguments attribute.

entity
Optional. Resource ID for the detail view being shown. If not passed,
defaults to the current entity.

params – Optional. String
starting with an ampersand (&) and containing any extra parameters
based on which the search is to be performed. The parameters passed
become available to the list view being invoked as request parameters.

Return value

None.

Example

This
example shows how an inventory audit list is invoked directly from
the Inventory Summary screen for a specified Organization, Item, UOM
and Product Class.

function showInvAuditSearch(sViewID,sItemID,sUOM,sProductClass,sOrgCode) 
{   
      var ItemID=document.all(sItemID).value;
      var UOM=document.all(sUOM).value;
      var PC=document.all(sProductClass).value;
      var Org=document.all(sOrgCode).value;
      var entity="inventoryaudit";
      var sAddnParams="&xml:/InventoryAudit/@ItemID="+ItemID+"&xml:
/InventoryAudit/@UnitOfMeasure="+UOM;
      sAddnParams=sAddnParams + "&xml:/InventoryAudit/@ProductClass="+PC+"&xml:/InventoryAudit/@OrganizationCode="+Org;
      
       yfcShowListPopupWithParams(sViewID,"",'900', '500','',entity, 
sAddnParams); 
}

YfcShowSearchPopup

Description

This
function invokes the specified search view in a pop-up window. This
function can be used to display lookup results.

Syntax

yfcShowSearchPopup(viewID,
name, width, height, argument, entity)

Input parameters

viewID – Required. Resource ID of the
search view to be shown as a pop-up window. If passed as an empty
string, the default detail view of the specified entity is displayed.

name
Required. Pass as a blank space (” “). Not used.

width
Required. Horizontal size of the pop-up window. Measured in pixels.
If passed as 0, a certain default width is used.

height
Required. Vertical size of the pop-up window. Measured in pixels.
If passed as 0, a certain default height is used.

argument
Required. Value passed as the argument parameter to the showModalDialog()
function that is used to show the pop-up window. This then becomes
available in the modal dialog through the window.dialogArguments attribute.

entity
Optional. Resource ID corresponding to the entity being searched for.
If not passed, defaults to the name of the current entity.

Return value

None.

Example

This
example shows how to invoke a single field lookup. The callLookup()
function invokes a search pop-up window.

From the search pop-up
window, when the user selects a row, the setLookupValue() function
is called with the selected value as a parameter.

The setLookupValue()
function populates the value in the text field and closes the lookup
search window.

function setLookupValue(sVal) 
{
   var Obj=window.dialogArguments
   if(Obj != null)
      Obj.field1.value=sVal;
   window.close(); 
}
//obj is to be passed as "this", 
// which would be the icon that was selected for lookup. 
//This function assumes that the lookup icon is placed 
// immediately after the text field on which lookup is requested. 
//entityname is the entity name of the search view 
// that needs to be shown in the lookup. 
function callLookup(obj,entityname) 
{
		var oObj=new Object();
		var oField=obj.previousSibling;
		while(oField != null && oField.type != "text" && oField.type != "TEXT")
		{
			oField=oField.previousSibling;
		}
		oObj.field1=oField;
		yfcShowSearchPopup('','lookup',900,550,oObj,entityname); 
}

YfcSpecialChangeNames

Description

This JavaScript function must be
called when an API requires that the entire row is passed if the key
is passed.

Syntax

yfcSpecialChangeNames(id,
checkOnlyBlankRow)

Input parameters

id – Required. ID
of the HTML tag under which the name changing must be performed.

checkOnlyBlankRow
Optional. If this is passed as true, only new blank
rows (where all inputs and selects are void) are considered for changing
names. If this is passed as false, then all the existing
rows under the object whose ID is passed are considered. If not passed,
the value defaults to false.

Return value

None.

YfcSplitLine

Description

This JavaScript function splits
a specific row into two rows.

Syntax

yfcSplitLine(imageNode)

Input parameters

imageNode – Required. Object pointer to
the image that is selected in response to which this function is called.

Output parameters

None.

The following table lists the attributes
to use at each cell level for determining the behavior of the newly
created rows.

Attribute Behavior
ShouldCopy Determines whether or not to copy the contents
of the cell, including child cells. If specified as true, the contents
are copied. If specified as false, the contents are not copied and
an empty cell is created. Defaults to false.
NewName Determines whether a new cell acquires an automatically
generated name. The generated name is derived from the name and row
count of the current object being copied. If specified as true, the
new cell acquires a new name. If specified as false, no name is generated.
Defaults to false. The name generating logic requires that the original
name contain “_integer” at the spot where the row
count must be inserted. For example, if the original name is xml:/InspectOrder/ReceiptLines/FromReceiptLine_1/@ReceiptLineNo,
the new row has an object with the name as xml:/InspectOrder/ReceiptLines/FromReceiptLine_2/@ReceiptLineNo.
NewClassName Class of the new copy of the object. For example,
if the class of the original object is unprotectedinput,
but if you want the new copy to be protected, specify the new class
as protectedinput. If not used, the class of the original object is
used in the copy.
NewDisabled Determines whether or not controls are created
in a disabled state. For some HTML controls (such as <img> tags),
this means disabling all actions on the control. If specified as true,
the property named disabled is set to true. If specified
as false, the disabled property is not be set. Defaults to false.
NewResetValue Determines the state of the value attribute
for the new object. If this is set to true, the new object’s value
attribute is voided. For most HTML controls, this results in the contents
of the control being blanked out. If specified as false, the value
of the original control is set in the copy. Defaults to false.
NewContentEditable Optional. Determines whether or not the new
object inherits the ContentEditable property of the current object.
If this is specified, the ContentEditable property of the current
object also becomes the new object’s ContentEditable property. For
some HTML controls (such as text box), this property controls whether
or not the control is editable. The value you specify becomes the
value set in the ContentEditable attribute in the copy. If this is
not specified, the new object inherits the current object’s ContentEditable
property.
NewTRClassName Optional. Specify the class of a new row that
is formed after a line split. If this attribute is not passed, the
default behavior is seen. For example, if a <tr> had classname=”oddrow” specified
as the class and you want to retain the same class in the new row
after a line split, then instead of <tr classname=”oddrow”> the
JSP should contain <tr classname=”oddrow” NewTRClassName
= “oddrow”>.

Example

This
example shows how you can split a line on the client side during returns
inspection so that a specific receipt line can be given multiple dispositions.

<yfc:loopXML binding="xml:/ReceiptLines/@ReceiptLine" id="ReceiptLine"> 
<tr>
   <yfc:makeXMLInput name="receiptLineKey">
       <yfc:makeXMLKey binding="xml:/ReceiptLine/@ReceiptLineKey" 
value="xml:/ReceiptLine/@ReceiptLineKey"/>
   </yfc:makeXMLInput>
  
   <td class="checkboxcolumn" ShouldCopy="false" nowrap="true">
       <input type="checkbox" value='<%=getParameter("receiptLineKey")%>' 
name="chkEntityKey"/>
   </td>
   <td class="checkboxcolumn" nowrap="true" ShouldCopy="false" >
       <img class="columnicon" <%=getImageOptions
(YFSUIBackendConsts.RECEIPT_LINE_HISTORY,"Disposition_History")%>></a>
    </td>
  <td class="tablecolumn" nowrap="true" ShouldCopy="false">
<yfc:getXMLValue binding="xml:/ReceiptLine/@SerialNo"/></td>
  <td class="tablecolumn" nowrap="true" ShouldCopy="false">
<yfc:getXMLValue binding="xml:/ReceiptLine/@LotNumber"/></td>
  <td class="tablecolumn" nowrap="true" ShouldCopy="false">
<yfc:getXMLValue binding="xml:/ReceiptLine/@ShipByDate"/></td>
  <td class="numerictablecolumn" nowrap="true" ShouldCopy="false">
<yfc:getXMLValue binding="xml:/ReceiptLine/@AvailableForTranQuantity"/></td>
  <td class="tablecolumn" nowrap="true" ShouldCopy="false">
<yfc:getXMLValue binding="xml:/ReceiptLine/@DispositionCode"/></td></td>
  <td class="tablecolumn" ShouldCopy="false" >
      <yfc:getXMLValue binding="xml:/ReceiptLine/@InspectionComments"/>
  </td>
    <td class="tablecolumn" nowrap="true" ShouldCopy="true" >
       <img IconName="addSplitLine" src="../console/icons/add.jpg" 
          <% if 
(getNumericValue("xml:/ReceiptLine/@AvailableForTranQuantity") > 1) { %>
             class="lookupicon" onclick="yfcSplitLine(this)" 
          <%} else {%>
style="filter:progid:DXImageTransform.Microsoft.BasicImage(grayScale=1)"
          <%}%>
          />  
          <input type="hidden"
<%=getTextOptions("xml:/InspectOrder/ReceiptLines/FromReceiptLine_" + 
ReceiptLineCounter + "/@ReceiptHeaderKey", 
"xml:/ReceiptLine/@ReceiptHeaderKey")%>/>
          <input type="hidden" 
<%=getTextOptions("xml:/InspectOrder/ReceiptLines/FromReceiptLine_" + 
ReceiptLineCounter + "/@ReceiptLineNo", 
"xml:/ReceiptLine/@ReceiptLineNo")%>/>
          <select NewName="true" NewClassName="unprotectedinput" NewContentEditable="true" NewResetValue="true" class="combobox" 
<%=getComboOptions("xml:/InspectOrder/ReceiptLines/FromReceiptLine_" + 
ReceiptLineCounter + "/ToReceiptLines/ToReceiptLine_1/@DispositionCode")%>>
        <yfc:loopOptions binding="xml:/ReturnDispositionList/
@ReturnDisposition" name="Description" value="DispositionCode"
selected="xml:/ReceiptLine/@DispositionCode"/>
          </select>
    </td>
    <td class="tablecolumn" nowrap="true" ShouldCopy="true" >
      <input type="text" NewName="true" ewClassName="numericunprotectedinput" 
NewContentEditable="true" NewResetValue="true" 
class="numericunprotectedinput" 
<%=getTextOptions("xml:/InspectOrder/ReceiptLines/FromReceiptLine_" + 
ReceiptLineCounter + "/ToReceiptLines/ToReceiptLine_1/@Quantity",  "")%>/>
    </td>
    <td class="tablecolumn" nowrap="true" ShouldCopy="true" >
      <input type="text" NewName="true" NewClassName="unprotectedinput" NewContentEditable="true" NewResetValue="true" class="unprotectedinput" 
<%=getTextOptions("xml:/InspectOrder/ReceiptLines/FromReceiptLine_" + 
ReceiptLineCounter + "/ToReceiptLines/ToReceiptLine_1/@InspectionComments",
"")%>/>
    </td> 
  </tr> 
 </yfc:loopXML> 
</tbody>

YfcValidateMandatoryNodes

Description

This JavaScript function validates
mandatory sections of a screen. The function parses through all the
TABLE elements in a page, and for each of the tables, looks for the
presence of the yfcMandatoryMessage attribute. If this attribute is
found, the function looks into the contents of the table. If the contents
have not changed, the function alerts the message set within the yfcMandatoryMessage
attribute for the corresponding <table> tag.

Syntax

yfcValidateMandatoryNodes()

Input parameters

None.

Output parameters

None.

Example

The
following example shows how mandatory validation is performed before
Save in the case of return receiving. First, the Save Operation is
configured to call the yfcValidateMandatoryNodes() function.

Second,
in the inner panel JSP, the following attribute is set for the table
that requires a validation check:

<table class="table" ID="ReceiveLines" width="100%" editable="true" 
 yfcMandatoryMessage="<yfc:i18n>Receipt_information_must_be_entered</yfc:i18n>">

YfcFindErrorsOnPage

Description

This JavaScript function can be
used within JSPs. This function is used to find errors on a page.
On finding an error, this function raises an appropriate alert message.

Syntax

yfcFindErrorsOnPage()

Input parameters

None.

Return value

None.

Example

This example shows how to call the
yfcFindErrorsOnPage() function from a JSP. While adding a dynamic
row inside a JSP, this function checks if the JSP has any errors on
a page. On finding an error, an appropriate alert message is displayed:

function addRows(element)
 {
    if(yfcFindErrorsOnPage()) 
       return; 
}

SetRetrievedRecordCount

You can review the details about the setRetrievedRecordCount JavaScript function. This JavaScript function can be used within JSPs created for list views.

Description

All list view screens typically have a message next to the title of the screen that indicates how
many records were retrieved. For example, the message displays Retrieved 2 record(s)
when the list view shows 2 records. You can use this JavaScript to set the count within this message dynamically. Typically, the UI infrastructure
automatically displays the correct message based on the output of the “List” API defined under the
entity resource for this list view.

However,
in some instances the “List” API cannot be used for a specific list
view. In these cases, the list view as been set to ignore the default
list API, and instead, calls its own API either by defining a different
API under the list view resource or within its own JSP through the
callAPI taglib. In this case, the UI infrastructure cannot automatically
display the correct message.

Syntax

setRetrievedRecordCount
(recordCount)

Input parameters

recordCount – Required. The correct record
count to display in the “Retrieved X record(s)” message.

Return value

None.

Example

This
example shows how to call the setRetrievedRecordCount() function from
a JSP defined for a list view. The correct count is computed as JSP
code. Then, this result is passed to the setRetrievedRecordCount method
which is called inside a script tag:

<%
   YFCElement root = (YFCElement)request.getAttribute("OrganizationList");
   int countElem = countChildElements(root); 
%> 

    setRetrievedRecordCount();

Join The Discussion

Your email address will not be published. Required fields are marked *