- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2014 05:54 AM
Hey guys,
I'm currently creating a UI page and using <g:ui_choicelist>, the parameters I have are name, table and field.
I was wondering if there was a way to set the value of this choicelist? It always defaults to the first in sequence?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2014 06:01 AM
Hi Fraser,
I have a ui page where i did create a dropdown, its the simple HTML code and its working just fine:
<select id="approvers" onchange="test()" style="width:200px">
<option value=''> -- None -- </option>
<option value='a'> A </option>
<option value='b'> B </option>
</select>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2014 06:26 AM
I have not tried the default select, but that you can order in the GR query using the gr.orderBy function, and the virst value in the <option> tag becomes selected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2014 06:34 AM
Thanks, the value I'm pulling is only going to be one field.
So
If the field on the other table is empty then it needs to default to <option>Select an answer</option> or if there is a value in the field on the other table then it needs to default to <option> $[value from field] </option>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2014 06:35 AM
try this attribute
selected="selected" in option
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2014 06:36 AM
Hi Harikrishnan,
Thanks, I tried that after posting my reply earlier, forgot to mention it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2014 06:46 AM
okay, i tried this one of the demo instances and it works perfectly:-
<html>
<select id="approvers" onchange="test()" style="width:200px">
<option value='' > -- None -- </option>
<option value='a' selected="selected"> A </option>
<option value='b'> B </option>
</select>
</html>
(I just used the code from one of the posts above)
If you need the selected value to be dynamic, I would say probably write a function onload of the page and then use dom to set the default value for the choicelist.
Regards,
Hari