Posted by threexk on May 26, 2008 at 6:46am
| Project: | Content Construction Kit (CCK) |
| Version: | 6.x-2.x-dev |
| Component: | optionwidgets.module |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
If a nodereference select list is required and default value is set to <None>, the default will actually be the first node in the list. This makes it too easy for a user to submit the form without actually selecting from the select list.
Proposed solution:
Allow dummy text to be set as the default value for a select list. e.g., "- Select -" or "" or just blank. If the form is submitted with this value selected, validation fails if the field is required. This text would be specified through the default value section within the nodereference select list configuration page.
(This issue may be similar to existing issue http://drupal.org/node/167809.)
Comments
#1
I second this (Except on D6). Spent the last two hours trying to find a solution... I dont want to dive into the module code unless I have to.
#2
That's actually a request for optionwidgets.
Moving to D6 branch, this is where development happens.
#3
Is there any news on this?
#4
Hi, any news on it?
I do have same problem.
if a field with dropdown list is required only the allowed values are showen and the default value is set to the first in the list. but there should be a value visible but not allowed to used for submitting.
the list of available values should be different (x+1) to allowed values (x)
if i do that by a simple list in allowed values i use "|" which can't be submitted. but if i use PHP code I can't get "|" on the begin of the array.
is there any help?
Thx in advance
HoKe
updated
this was helpful for me. I got it working. I updated the includes/form.inc
http://drupal.org/node/206844#comment-1997930
#5
Look at this http://drupal.org/node/206844
There is some code for 5.x there, still working on 6.x
#6
I was getting the same problem. here is the problem that I had
Module - nodereference
when - select list is single select and required the first value in the list was selected by default
Here tweaks I did to solve this issue - see patch file below
#7
Thank for the link Hoke
I applied the patch and get everything working.
#8
Try this mini module http://drupal.org/node/789116#comment-3365604
#9
Subscribing.
Installed the mini module and it's working well.
Haven't tested the patch yet since I needed to use it on a live site and don't want to patch it. But I think this is a very important UI improvement.
Admin users will inevitably at some point skip over a field that's already populated, leaving the field with an incorrect selection without the admin even being alerted to their mistake.
I think the ability to make node reference fields (and other types that function the same way) required is currently useless with it automatically populating a value like it does. It's usually preferable to have the field remain empty than for it to have wrong data if the admin user accidentally skips the field.
Use case: The node reference field is for the location of an event. If the field were not required, it would be left blank if the admin skipped it. Users wanting to attend the event don't know where it is. They email the admin and ask where the event is going to be. The admin is then notified of their mistake without users being extremely dissatisfied, because they can still show up to the right place at the right time.
The way things are now, when an admin skips a required field, it still contains some value. If this were the wrong location, customers would have no way of knowing the location is wrong and no reason to contact the admin. They would show up to the wrong location, waste their time, gas money, miss the event, and demand a refund. They would rightfully be very angry and not likely to be repeat customers.
Hence, making the field required is currently worse than leaving as optional even if it is something that ought to be required.