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 field collection field as "main_field_collection_field".
Then have 2 fields in that collection as "field_1" and "field_2".
None of these 3 fields have the Required option checked.
Can I use this module to make the field_2 to be required whenever there is some/any data in field_1 on form submission?
Thanks...
Comments
Comment #1
g089h515r806 CreditAttribution: g089h515r806 commentedCurrently, such issue could be solved by php code validator.
Comment #2
hgurol CreditAttribution: hgurol commentedI would be very very happy if you can provide a sample for me. My own php knowledge is almost zero.
Thank you soooo much :)
Comment #3
g089h515r806 CreditAttribution: g089h515r806 commentedDOCs :http://drupal.org/node/1537028
add php code validator to field_2
sample code :
Comment #4
glynster CreditAttribution: glynster commentedI tried this however no luck, the field saves and no error with the textfield is empty.
My setup is a field collection where a user can add a Youtube video or upload a video. The title field needs to be required when either video field is added.
At the moment I have the following setup:
field_video_title
field_video_yt (the php rule above I have added but no luck)
field_video_upload
Is there something I am missing?
Comment #5
nithinkolekar CreditAttribution: nithinkolekar commented+1
Use case example
Two fields: email id and boolean field "create account" is present. Where email id optional only when "create account" is not checked(true) but should validate to required if boolean value is set to true.
Comment #6
g089h515r806 CreditAttribution: g089h515r806 commentedIt is possible to solve it by adding a condition choice,