Hi,
We have a Dynamic List that essentially populates addresses. I would like to detect if the list contains no values (null returned from the dynamic list?) so I can display an appropriate message to the user.
Ideally without using a database resource to do the same sort of lookup.
Is there a way to detect that a list returns no values?
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 95
- Joined: Wed Feb 27, 2013 5:16 pm
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
You can check the number of entries within the list. Dynamic lists are normally built after all scripts have run, which would be too late in this case. To get around this, you could build the list from within a script, then set field list property When list is built to Never to stop the automatic list building. Code something like this:
This means that the list will be built when, and only when, the script executes.
Code: Select all
// Build the list
fields.F1.list.buildList();
// Get number of list entries
var n = fields.F1.list.getDisplayValues(false).length;
0 x
-
- Ebase User
- Posts: 95
- Joined: Wed Feb 27, 2013 5:16 pm
Thanks Jon,
I actually found another workaround using Jquery. The entire purpose was to display a panel/text control if nothing was available in the list. My work around meant handling that in Jquery as well (which is fine if a bit tedious). I just added this to the html element properties
Thanks
I actually found another workaround using Jquery. The entire purpose was to display a panel/text control if nothing was available in the list. My work around meant handling that in Jquery as well (which is fine if a bit tedious). I just added this to the html element properties
Code: Select all
$('#ddl_html_id option').length;
0 x
Who is online
Users browsing this forum: No registered users and 21 guests