Looping through a choice list
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2009 05:34 AM
I have a table called "Project Codes" which is connected to my change form as a choice list.
Project codes have a number and a company name ... what I would like to do is prune
all project codes that do not belong to a certain company after the company field has been
filled.
What I'm not sure about is how to loop through a choice list ... any pointers? 🙂
function onChange(control, oldValue, newValue, isLoading) {
var requester = g_form.getReference('requested_by');
if (requester.company) {
var temp_pc_list = g_form.getReference('u_project_code');
g_form.getControl('u_project_code').options.length = 0;
// loop through temp_pc_list and add matching companies to u_project_code
// while (not end of list(temp_pc_list)) {
// if (list.element.company == requester.company) {
// g_form.addOption('u_project_code', '0', list.element);
// }
//}
}else{
/*No Company ... We don't do anything */
}
}
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2010 05:59 PM
Here's the loop:
var options = g_form.getControl('field_name').options;
for (i=0; i<options.length; i++) {
alert(options<i>.value);
}
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2010 05:30 AM
cool thx!