GetTextOptions

You can review the details about the getTextOptions JSP function.

Description

This JSP function XML binds text input fields when modification rules do not need to be considered.

Syntax

String getTextOptions(String name)

String getTextOptions(String name, String value)

String getTextOptions(String name, String value, String defaultValue)

Inserting this function enables setting the value of a text input when it is displayed and setting the path and attribute in an XML to where the value should go when the form is posted.

If the value and default value are not given, the default value is blanks and value defaults to name.

Input parameters

name - Required. Path in the target XML to which the value in the input text is sent when the form is posted. The target XML is then passed to the appropriate API through the Service Definition Framework.

value - Required. Specifies what to display as the input text. Can be a binding or a literal. Default is name.

defaultValue - Required. This can be a binding or a literal that is defaulted to in the case that the value binding returns nothing. Default is blanks.

Example
This example results in a input text that displays the value of a bound attribute and sets the value of a bound attribute when the form is posted. This is the XML referenced by the bindings:
<Order>
   <addlInfo Country="US"></addlInfo> 
</Order>

JSP usage

<input type="text" <%=getTextOptions("xml:Order:/OrderAddlinfo/@Country",
"xml:Order:/OrderAddlinfo/@Country", "USA")%> />

HTML results

When the value binding is found:

<input type="text" name=" xml:Order:/OrderAddlinfo/@Country " value="US"
Datatype='' size="10" Decimal='' OldValue="United States"/>

When the name binding is not found:

<input type="text" name="US" value="USA" Datatype='' size="10" Decimal='' 
OldValue="United States"/>

Using getTextOptions within an editable list:

  • An underscore (" _ ") and a counter must be appended to the first parameter of getTextOptions.
  • The name of the counter is the value of the ID attribute specified in the loopXML tag. Set the ID attribute to be the same as the name of the child node on which you are looping.
Example
Inserting a text box.
<input type="text" class="unprotectedinput"
<%=getTextOptions("xml:/Order/OrderLines/OrderLine_" + OrderLineCounter + 
"/@ShipNode", "xml:/OrderLine/@ShipNode")%>/>