Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

How to prevent NULL entry in dropdown list?

Post Reply
tschutter
Posts: 15
Joined: Fri Nov 23, 2012 11:31 pm

How to prevent NULL entry in dropdown list?

Unread post 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.
zazzium
Posts: 84
Joined: Mon Jul 04, 2011 12:52 am

Re: How to prevent NULL entry in dropdown list?

Unread post 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.
tschutter
Posts: 15
Joined: Fri Nov 23, 2012 11:31 pm

Re: How to prevent NULL entry in dropdown list?

Unread post 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.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: How to prevent NULL entry in dropdown list?

Unread post 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
tschutter
Posts: 15
Joined: Fri Nov 23, 2012 11:31 pm

Re: How to prevent NULL entry in dropdown list?

Unread post by tschutter »

I assume in the Before Open tab? That doesn't work.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: How to prevent NULL entry in dropdown list?

Unread post by admin »

Try this in the Javascript section of Custom Code of your Form's property..
tschutter
Posts: 15
Joined: Fri Nov 23, 2012 11:31 pm

Re: How to prevent NULL entry in dropdown list?

Unread post by tschutter »

Ah, I missed that tab. I added that code to the Javascript tab. Didn't work.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: How to prevent NULL entry in dropdown list?

Unread post by admin »

Are you using tra_type?
Post Reply