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; 
     }
   } 
 }

Join The Discussion

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