I'm building a number of content types and need to make use of the required select boxes. One thing that is important is the validation of required fields. I have noticed that my select boxes that are set as required, the first value of the options list is always displayed. this gives the appearance that this choice was selected by the user, and may lead to incorrect submittions. My preference would be to have nothing display until the users takes action.

If I set the field to not required, it works this way, but then I cannot utilize the validation.

I tried to use the php default value code box to construct a null field but couldn't get it to work. My only other workaround is to add an option to every select box of 0|Select a value. But that is not ideal.

How can I set the default value of required select boxes to null?

Thanks

Comments

mooffie’s picture

Put a "|" on a line by itself in the 'allowed values'.

Of course, what you describe should be the default behavior of CCK --but it isn't. I've seen several complaints in CCK's issue queue, but they were worded poorly and the developers didn't understand them.

Harley_Dog’s picture

thanks mooffie - that did the trick.

intent’s picture

Amazing!

Thanks a ton mooffie, I've been researching this same issue for hours and finally stumbled upon your incredibly succinct and helpful answer. You are a life saver.

hgurol’s picture

Thanks mooffie, found this after spending more than an hour to figure out how to do it.

As a side note;
I used "| Make a selection" which works as well...