- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-23-2014 08:10 PM
I want to have a dropdown box on a UI Page, and then be able to pull what the selected value of that dropdown box is (perhaps to use as a filter for a GlideRecord query).
What I have so far:
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<select id="analyst" style="width: 160px;" name="analyst">
<option value="AGILLI5">Aaron G</option>
<option value="AHALLE3">Abbey H</option>
</select>
<g2:evaluate>
var dropdownanswer = document.getElementById("analyst");
var strUser = e.options[e.selectedIndex].value;
</g2:evaluate>
$[dropdownanswer]
</j:jelly>
Section in bold is most likely completely wrong. How do I create a simple variable that tells me what the current selection is of my dropdown box on the UI Page?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2014 07:43 AM
For every URL parameter with "sysparm_" prefix, a corresponding Jelly variable prefixed with "jvar_" is automatically created and is available for processing in the HTML field of the UI page. You can read more about it here:
Below is a sample UI page you can use an example. Is it similar to what you were looking for?
Name:
analyst_stats
HTML:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<j:set var="jvar_analyst" value="${sysparm_analyst}" />
<j:set var="jvar_analysts_list" value="Alice,Bob,Charlie" />
<g:tokenize var="jvar_people" delim=",">
${jvar_analysts_list}
</g:tokenize>
<g:ui_form>
<select id="analyst" name="analyst">
<option value="">-- Select --</option>
<j:forEach var="jvar_choice" items="${jvar_people}">
<j:if test="${jvar_choice == jvar_analyst}">
<option value="${jvar_choice}" selected="selected">${jvar_choice}</option>
</j:if>
<j:if test="${jvar_choice != jvar_analyst}">
<option value="${jvar_choice}">${jvar_choice}</option>
</j:if>
</j:forEach>
</select>
<g:ui_spacer />
<g:dialog_button_ok ok_id="ok_button" />
</g:ui_form>
<j:if test="${!empty(sysparm_analyst)}">
<p>Displaying personal stats for ${sysparm_analyst}</p>
</j:if>
</j:jelly>
Processing script:
if (analyst != '') {
my_target = 'analyst_stats.do?sysparm_analyst=' + analyst;
} else {
my_target = 'analyst_stats.do';
}
response.sendRedirect(my_target);
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2014 10:09 AM
Wow, that works great! Opens up a lot of potential.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2016 04:46 PM
Hi Slava,
We have similar kind of problem. We are using advance knowledge base search in our cms site. The search is performed by selecting value from drop down fields. The issue is after search is performed the drop down values are set back to default value. But we need them to be retained as searched. Any help would be greatly appreciated. Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2016 08:39 AM
Let's discuss this matter in the separate thread you created:
Advanced Search KB in CMS Site
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2017 03:34 PM
Hello Slava
very helpful answer. I have a query that instead of one drop down menu if we have another drop down menu (for example Department), then what changes are needed to be done in the processing script? How can we add sysparm_Department into the link?
Thanks
Imran

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2017 02:15 PM
Got it by doing following. (Two drop menus)
my_target = 'analyst_stats.do?sysparm_analyst=' + analyst+"&sysparm_department=" + department;