[bug] Custom required function based on a select_single_radio field or select_multiple_* fields

eugenio

Administrator
Staff member
If you have a custom required function which is based, in input, on the value of a select_single_radio field, the value of the select_single_radio field is not correctly passed to the function. To fix this issue, change, in include/header.php

this code:

if (name != ''){
field_names[c_temp]=name;
field_values[c_temp]=this.value;
c_temp = c_temp+1;
}

with:

if (name != ''){
if ( $(this).is('input:radio') ){
if ( $(this).is(':checked')){
field_names[c_temp]=name;
field_values[c_temp]=this.value;
c_temp = c_temp+1;
}
}
else{
field_names[c_temp]=name;
field_values[c_temp]=this.value;
c_temp = c_temp+1;
}
}

please note that if the user didn't select anything for the radio field (e.g. a field "product_type"), the corresponding $parameters_ar['product_type'] won't be set.

You can have similar problems with select_multiple_* fields, whose value at the moment cannot be correctly used as a source of a custom required function.

Best,
 
Top