Drupal webform atleast one of the fields mandatory
I am using webforms and I have three fields were either one of em should be filed.
Use the “additional validation” input box in the form “configuration”.
The code is following:
<?php
$book= $form_values['submitted'][11];
$author= $form_values['submitted'][12];
$isbn= $form_values['submitted'][13];
if (($book == NULL) AND ($author == NULL) AND ($isbn == NULL))
{
form_set_error(”, t(’Please enter either Book Title or Author or ISBN.’));
}
?>
The 11, 12 and 13 is the field id of your input fields. To find the field IDs mouse over the “edit” link next to your fields in the “Form Components”.
k