Page 1 of 1
How to prevent NULL entry in dropdown list?
Posted: Sun Nov 25, 2012 2:46 am
by tschutter
I am using nubuilder-v2.7.4.11-12.10.24-Build529 on Ubuntu 12.10 browsing with Chromium 22.0.1229.94.
When creating the list of items for a dropdown menu, nuBuilder always adds a NULL item to the beginning of the list even if I set "Stop Blanks" to "Yes" on the Dropdown tab. How can I prevent the NULL item from being added?
I would think that if NULLs are not allowed for a field, we should not present a NULL choice to the user.
Re: How to prevent NULL entry in dropdown list?
Posted: Sun Nov 25, 2012 6:18 pm
by zazzium
if u set "Stop Blanks" to "Yes" the form can't be saved before user has selected some value.
i don't share your logic, but you can solve the "problem" by setting a default value for the dropdown.
Re: How to prevent NULL entry in dropdown list?
Posted: Mon Nov 26, 2012 2:53 am
by tschutter
I am already setting a default value for the field. That does not solve the problem. The problem is that we are presenting an option to the user that is not valid. Why present to the user an option that is not valid? I go through the effort of presenting only valid choices, and nuBuilder adds an invalid choice to the list.
It is a usability issue.
Re: How to prevent NULL entry in dropdown list?
Posted: Mon Nov 26, 2012 3:06 am
by admin
tschutter,
Try this in the
Javascript section of
Custom Code of your Form's property..
Code: Select all
function nuLoadThis() {
$("#tra_type option[value='']").remove();
}
Steven
Re: How to prevent NULL entry in dropdown list?
Posted: Mon Nov 26, 2012 3:14 am
by tschutter
I assume in the Before Open tab? That doesn't work.
Re: How to prevent NULL entry in dropdown list?
Posted: Mon Nov 26, 2012 7:09 am
by admin
Try this in the Javascript section of Custom Code of your Form's property..
Re: How to prevent NULL entry in dropdown list?
Posted: Tue Nov 27, 2012 3:46 am
by tschutter
Ah, I missed that tab. I added that code to the Javascript tab. Didn't work.
Re: How to prevent NULL entry in dropdown list?
Posted: Tue Nov 27, 2012 5:12 am
by admin
Are you using tra_type?