Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This has been spliced from http://drupal.org/node/53351
To reproduce:
-Create a multi-select vocabulary and associate it with a node type. Populate it with a few terms.
-Create a node of this type and associate it with some of the above terms.
-Edit the node, remove all the terms from said vocabulary. Click Preview or submit.
-The changes are not saved and the default values are stored.
It is assumed that the issue linked above has been committed..
-K
Comment | File | Size | Author |
---|---|---|---|
#6 | posted.patch | 1.11 KB | chx |
#5 | 20060311jv.patch | 701 bytes | jvandyk |
#2 | 53480_form_default_values_0.patch | 751 bytes | Zen |
#1 | 53480_form_default_values.patch | 1.08 KB | Zen |
Comments
Comment #1
Zen CreditAttribution: Zen commentedI don't really grok form.inc, but here's a shot at this. Patch attached.
I'm not sure of the ramifications of this - esp. w.r.t. multipart forms, nor am I sure about the needs_validation statement. Please test thoroughly.
Thanks
-K
Comment #2
Zen CreditAttribution: Zen commentedAnother approach?
Please review both patches.
Thanks
-K
Comment #3
chx CreditAttribution: chx commentedComment #4
kkaefer CreditAttribution: kkaefer commentedBoth patches from Zen work for me flawlessly. I'd take the second patch though.
Comment #5
jvandyk CreditAttribution: jvandyk commentedSecond patch works. Tested with multiple multiple-select vocabularies. This patch is the same; just makes comment style and terminology consistent.
Comment #6
chx CreditAttribution: chx commentedNow you can not temper with a simple checkbox, before it was not checked. We remove linebreaks from mere textfields, there is no way this breaks user data, only hackers are interested. This puts many header injection attacks at rest. And yes, we care for empty selects. And last, but not least, we make the whole thing readable.
Comment #7
kkaefer CreditAttribution: kkaefer commentedchx' patch works for me.
Comment #8
Dries CreditAttribution: Dries commentedHow about:
instead of:
Comment #9
kkaefer CreditAttribution: kkaefer commentedDries, trim does only remove leading or trailing whitespace, not line breaks within the string. Probably use both.
Comment #10
Zen CreditAttribution: Zen commentedPatch applies cleanly. Testing:
+1
-K
Comment #11
chx CreditAttribution: chx commentedDries, you do not want to merely remove the ending \r \n but all instances of them. On the other hand, you do not want to remove spaces in the beginning for example. So I fail to see how trim is appropriate here.
Comment #12
Dries CreditAttribution: Dries commentedNevermind my comment. chx is right. :)
Comment #13
Dries CreditAttribution: Dries commentedTested the patch. Committed to HEAD.
Comment #14
moshe weitzman CreditAttribution: moshe weitzman commentedZend said: "#requireds work as expected on all elements."
The required it on a checkbox is being ignored. The use case for required checkbox is on trms of service agreements and so on. The user should not pass validation until checkbox is checked.
Further, the CSS on a required checkbox is different from other form elements and thus isn't getting styled properly.
Not sure if this report belongs here but is good for now. At least is out of my head.
Comment #15
moshe weitzman CreditAttribution: moshe weitzman commentedfor testing, the easiest way to add a required checkbox is to use admin/settings/profile
Comment #16
moshe weitzman CreditAttribution: moshe weitzman commentedoops. my checkout was stale. the validation works now. class attribute is different though and appears unrequired in bluemarine
Comment #17
LAsan CreditAttribution: LAsan commentedchx: Still an active task?
Comment #18
alexanderpas CreditAttribution: alexanderpas commentedseems fixed to me, using the method from #15 the indicator displayed correctly.