In one of my content types I have 1 field 'venue' with a drop down option. If I select 'venue' as 'other' from the drop down, some other fields (say 'venue address' and 'venue name') should become required fields and the node should not be saved or updated if those required fields are empty.
This is the screenshot of the rule I created.
This is my rule in Rules export format:
{ "rules_schedule_program_venue" : {
"LABEL" : "Schedule Program venue",
"PLUGIN" : "reaction rule",
"ACTIVE" : false,
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_presave--schedule_programs" : { "bundle" : "schedule_programs" } },
"IF" : [
{ "entity_has_field" : { "entity" : [ "node" ], "field" : "field_venue" } },
{ "entity_has_field" : { "entity" : [ "node" ], "field" : "field_venue_address" } },
{ "data_is" : {
"data" : [ "node:field-venue" ],
"op" : "IN",
"value" : { "value" : { "9" : "9" } }
}
},
{ "data_is_empty" : { "data" : [ "node:field-venue-address" ] } },
{ "node_is_of_type" : {
"node" : [ "node" ],
"type" : { "value" : { "schedule_programs" : "schedule_programs" } }
}
}
],
"DO" : [
{ "drupal_message" : {
"message" : "address field is required",
"type" : "error",
"repeat" : "0"
}
}
]
}
}
Please let me know what Rules Action I need to add to show an error message without updating or saving node.
I tried adding the Show a message on site action, but it is updating or saving the node anyway. I also tried with the Set an error on the form action, but in Data selector there isn't the field venue address.
Any other suggestion using javascript or jquery to achieve this task is also fine.
Can anybody help me in using 'Rules Forms' module in this case?