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.
Hi,
I have a conditional, required field which is rejected even when it is submitted complete. By rejected, I mean that the node edit form returns error "field x is required" even when it was complete upon submission.
I have checked and can confirm that when I remove the condition from the required field in question, it behaves properly (Errors when left empty, saves when submitted complete)
I am using Drupal Core 6.25 with Conditional Fields version 6.x-2.0
Please let me know if you need more information, Thanks in advance!
Comment | File | Size | Author |
---|---|---|---|
#4 | conditional_fields-required-fields-1488386-2.patch | 1.37 KB | areynolds |
#3 | conditional_fields-required-fields-1488386-1.patch | 956 bytes | yvmarques |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedI have the same problem on Drupal 7. It won't accept the form.
Comment #2
goldtopdon CreditAttribution: goldtopdon commentedHi,
The patch supplied in #11 here fixed my problem, may help others too:
http://drupal.org/node/722236
Regards,
Dan
Comment #3
yvmarques CreditAttribution: yvmarques commentedI had the same problem and I could fix it with the attached patch.
To be honest I haven't tried with other modules than just CCK, might need some reviews.
Comment #4
areynolds CreditAttribution: areynolds commentedReviewed the patch in #3; the removed code was causing the error in my case, but so was the following block:
This block occurs after $value may have been defined by preceding code. If a legitimate, non-null $value exists, the "else" clause will mean that it is always ignored and the field is regarded as empty. Deleting the else clause causes no harm; if $value is empty (a null value), this will be caught by the final logic check:
Attached patch builds off of #3 and deletes the else clause. I'm wary of getting rid of the block deleted by patch #3, but I'm not familiar with hook_content_is_empty, so perhaps others can advise?
Note that this patch applies against 6.x-2.x-dev.
Comment #5
alibama CreditAttribution: alibama commentedConfirm patch #4 fixed us using the latest dev version = thanks areynolds et al
Comment #6
yvmarques CreditAttribution: yvmarques commentedAs I understood, the hook_content_is_empty doesn't check if the content is empty but set the default empty value to the field.
Comment #7
areynolds CreditAttribution: areynolds commentedSo it's a function that allows you to designate custom "empty" functions on a field-by-field basis? If this is the case, we should debug that code block removed in #3.
Comment #8
Danny EnglanderI ran up against this same issue today and the patch in #4 worked to fix a conditionally required text field but not for a conditionally required imagefield image. In other words on the same node I have both and the textfield works as expected now but I still get an error on node save that the image is required even after I've checked off to allow for an image and uploaded an image. I don't know enough of the nuances here to figure out why.
Comment #8.0
Danny EnglanderAdded details of my Drupal and CF version
Comment #9
peterpoe CreditAttribution: peterpoe as a volunteer commented