Call-back syntax

<< Click to Display Table of Contents >>

Navigation:  General Functions > Configuring the MIE (Programmer's Guide) > Portal Design > Software Request Portal Design (Programmer's Guide) > Ajax Call-backs >

Call-back syntax

The Gen2 SRP has a javascript routine available called DoCallBack.  The DoCallBack routine takes two parameters, the action code and a delimited list of div's to be updated with HTML that will be returned by the MIE.  The following call-backs are available on the Gen2 SRP:

 
A - refresh a control.  This is usually done to refresh a control that is related to another control on the screen, such that when the first control's value changes, it will change the associated list of items in the second control.  Note that you must first set the value of the DOM variable ControlToRefresh553 with the name of the control you want to refresh.  Also note that the control you want to refresh must be contained within a div, and that div must be named the same as the control to refresh with the letters "div" preceding the name.

Example:

(the call-back syntax)
OnChange="SetControlValue('SRPMfr1550','-Select-');SetControlValue('SRPProdDesc1550','-Select-');SetControlValue('ControlToRefresh553','SRPMfr1550');DoCallBack('A','divSRPMfr1550');"

(the actual control inside its div on the form, with a merge tag that defines the control itself)
<div id="divSRPMfr1550" name="divSRPMfr1550">[%SRPMfr1550,Input,,%]</div>

 
C - commit the transaction.  Until this call-back is invoked, all data entered is maintained in the user's DOM (in the browser).  This call-back actually commits the data to the MIE's database and will, if successful, return an order number.  The order number is available via [%V6%] of the predefined variables.  It is also carried in the Order553 DOM variable and can be referenced there. When calling this call-back, all screen areas will be refreshed, so the second variable passed to DoCallBack needs to be the delimited list of all areas (see the example below).

Example:

onclick=if(Validate()==false){return;}NextBack('UP');DoCallBack('C','ButtonArea~HeaderArea~Area1~Area2~Area3~Area4');

 
L - Perform a lookup based on the information contained in the DOM variable ControlToRefresh553.  The variable ControToRefresh is loaded with a comma delimited list of which lookup areas are to be re-generated (1 through 4).  Each lookup area is expected to be contained in the HTML document in a div named divLookup<n><m>, where <n> is the step and <m> is the lookup area within the step (1-4).  The call-back can refresh up to all 4 lookup areas in one call-back, if needed.  Only the lookup areas specified for the current step will be regenerated and returned.

If the lookup area does not specify a DOM variable whose contents are to be used as the key value for performing the lookup, then the javascript that sets up the lookup must first populate the DOM variable KeyValueLU553 with the key value that will be used to perform the lookup.

Example:

onBlur=SetControlValue('KeyValueLU553',this.value);SetControlValue('ControlToRefresh553','1');DoCallBack('L','divLookup11');

 
U - Add an item to the order area.  The current order area is returned.  The Gen2 SRP provides a javascript routine called AddManifestItem which is used to perform the call-back.  AddManifestItem takes one parameter, which is the delimited list of divs to be refreshed with the information returned by the call-back.
 

Example:

onclick=AddManifestItem('divOrderArea3');

 

V - refresh the  current step's order area.  This will cause the order area to be re-evaluated, expanded through any tags, and returned as HTML.

Example:

<span class="BlackLink" onclick="DoCallBack('V','divOrderArea3');">Update</span>