- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2017 09:35 AM
Hi All,
We're on Helsinki ...
I've got a UI PAGE attempting to populate a SELECT; choosing one entry to be SELECTED...
<select name="selectList" id="selectList" onchange="getSelectListOptionValue(this)">
<j:while test="${jvar_list.next()}">
<j:set var="jvar_value" value="${jvar_list.getValue('u_vendor_name')}"/>
<j:choose>
<j:when test="$[jvar_value== searchBy]">
<option value="${jvar_value}" selected="selected">${jvar_value}</option>
</j:when>
<j:otherwise>
<option value="${jvar_value}">${jvar_value}</option>
</j:otherwise>
</j:choose>
</j:while>
</select>
The value of 'searchBy' is known to be a valid case of one of the jvar_value
The line ==>
<j:when test="$[jvar_value== searchBy]">
Is never found to come true though ALERTs have show that jvar_value and searchBy have the same value for one record... I've got a test suite of 2 records.
Any ideas?
The line== searchBy]">
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2017 11:25 AM
Interestingly, it looks like Jelly will not support a combination of a jelly variable (jvar_value) and a javascript variable (searchBy) in the test condition. It seems to work if both are jelly variables or both are javascript variables.
You also need to fix the syntax in the test condition to use curly braces {} instead of box brackets [] since this is to be evaluated in phase 1 as mentioned by Chuck above.
One way of fixing this would be to use a g:evaluate or a j:set to set the value of searchBy in a jelly var (jvar_searchBy) and change the test condition in line 1 above to be:
<j:when test="${jvar_value == jvar_searchBy}">
Hope that helps.
PS: Please hit "Correct", "Helpful" or "Like" depending on the impact of the response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2017 11:25 AM
Interestingly, it looks like Jelly will not support a combination of a jelly variable (jvar_value) and a javascript variable (searchBy) in the test condition. It seems to work if both are jelly variables or both are javascript variables.
You also need to fix the syntax in the test condition to use curly braces {} instead of box brackets [] since this is to be evaluated in phase 1 as mentioned by Chuck above.
One way of fixing this would be to use a g:evaluate or a j:set to set the value of searchBy in a jelly var (jvar_searchBy) and change the test condition in line 1 above to be:
<j:when test="${jvar_value == jvar_searchBy}">
Hope that helps.
PS: Please hit "Correct", "Helpful" or "Like" depending on the impact of the response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2017 11:44 AM
Thanks a lot, Paresh ..
I've changed the script as follows for a positive result.
<j:set var="jvar_value2" value="${searchBy}"/>
<j:when test="${jvar_value == jvar_value2}">