|
%js-props() Function |
|
|
%js-props() function is used to build parameters for Javascript calls. Syntax: %js-props(properties-and-values) properties-and-values Defines the names and the values of the symbols that will be the members of the Javascript Object parameter. Parameter syntax: prop-name[:value-expression] [,prop-name[:value-expression] ... ]
prop-name The name of the Object member. value-expression The expression that specifies the value of the Object member. If omitted the value is taken from the identically named CScript symbol.
Examples: myJsFunction( { %js-props('elmName:name, template, valFunc: validation') } )
Result: (Random values used) myJsFunction( { elmName:'PRICE', template:'Template1', valFunc: 'PriceValidation') } )
<input type="text" mo:props="%js-props('nonBlank:validation.required, isNumber:validation.isnumber, validValues:validation.vvals, customValFunction:validation.custom, valErrorHandler:validation.handler')" />
Result: (Random values used) <input type="text" mo:props="nonBlank:'true', customValFunction:'ValidateEmail')" />
Note: If the value is empty or equals to false no Object member is created. That's the reason why the number of the Object members is less than the number of the properties in the definition.
|