[eluser]Monarobase[/eluser]
Hello, using the form validation helper I have run into a limitation and would like to know if there is a clean way to do this or not.
In my form I've got an element called "name" which is a drop down list with "Yes", "No", "Other" and a text input called name_other and I want to specify that if "name_other" is selected in the drop down list then the name_other text field is required and otherwise is not.
I could do this using a callback but 15 fields like this would mean 15 callbacks unless I could retreive the field name in the callback in which case I could check "name_other" with a function like this :
Code:
function _check_other($val,$input_name)
{
if($val == 'other') {
if($_POST[$input_name.'_other'] == '') {
}
}
}
Can I do something like this ? And if not would in not be an interesting feature to be able to have an extra $input_name value passed onto the callback function ?