GetSearchCriteriaValueWithDefaulting

You can review the details about the getSearchCriteriaValueWithDefaulting JSP function.

Description

This JSP function handles the situation where you want to use a default value in the search criteria fields. This special function is required because it is necessary to distinguish between when the user has come to a screen initially versus when a saved search has been loaded and this attribute has specifically been saved as "blank" in the saved search. If this type of saved search is being loaded into the search view, then the defaulting should not take place.

Syntax

String getSearchCriteriaValueWithDefaulting(String binding, String defaultBinding)

Input parameters

binding - Required. The target XML binding of the search criteria field that needs to have its value defaulted accordingly.

defaultBinding - Required. The XML binding (or static value) from where the default value should come from when the user is navigating to that search screen for the first time.

Output parameters

A string containing the value that is displayed in that search criteria field.

JSP usage

This example shows how an "enterprise code" combo box on an order search screen can be defaulted to the primary enterprise code of the logged in user's organization.

<td class="<%=inputTdClass%>" nowrap="true">
   <select class="combobox" <%=getComboOptions(enterpriseCodeBinding)%>>
	  <yfc:loopOptions 
binding="xml:CommonEnterpriseList:/OrganizationList/@Organization" 
name="OrganizationCode" value="OrganizationCode"
selected='<%=getSearchCriteriaValueWithDefaulting("xml:/Order/@EnterpriseCode",
"xml:CurrentOrganization:/Organization/@PrimaryEnterpriseKey")%>'/>
    </select> 
</td>