Conditional Fields and Required attribute not working as intended
-
I am using PMPRO with Register Helper add on, I have created a conditional field like this:
$fields[] = new PMProRH_Field( 'profession', 'radio', // type of field array( 'options' => array( 'Judge' => 'Judge', 'Attorney' => 'Attorney', 'Social Worker' => 'Social Worker', 'Attorney & Social Worker' => 'Attorney & Social Worker', 'Other' => 'Other' ), 'label'=>'Profession', 'required'=>true, 'profile' => true, ) ); $fields[] = new PMProRH_Field( "other_profession", "textarea", array( "depends"=>array(array('id' => "profession", 'value' => "Other")), "label"=>"Please Specify Other", 'profile' => true, ));
so I need the dependent field(please specify other field) required only if the “other” option selected from the “Profession”. If I give ‘required’=>true to “other_profession”(Please Specify Other) this dependent field will be always be required, and even if I don’t select other option from “Profession” I get required field error when submit the form. Is there any option I am missing, or any work around?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Conditional Fields and Required attribute not working as intended’ is closed to new replies.