Hello, to select an order I just used some select fields (first_option,second_option,third_option) and add a validation, but I get always the error 'You have to select different options' indepently of the options selected:
if (($form_values['submitted_tree']['first_option'] == $form_values['submitted_tree']['second_option'])||($form_values['submitted_tree']['first_option'] == $form_values['submitted_tree']['third_option'])||($form_values['submitted_tree']['third_option'] == $form_values['submitted_tree']['second_option'])) {
form_set_error('submitted][first_option', t('You have to select different options'));
}
Later I just created a validation for just two fields, to check it, but that's not working either... Any help? Thanks!
if ($form_values['submitted_tree']['first_option'] == $form_values['submitted_tree']['second_option']) {
form_set_error('submitted][email1', t('You have to select different options'));
}
Comments
Comment #1
quicksketchThis all looks fine to me. Did you check to make sure that the variables you're comparing actually contain values? If they're both NULL, then that expression would equal TRUE every time.
Try putting this in your validation code just to ensure that some value exists in these variables:
Comment #2
quicksketchClosing after lack of activity. Support for custom code is no longer provided in the Webform issue queue.