I have form with static fields and dynamic fields as follow:
fieldset
- textfield00 (require = true)
- textfield01 (require = true)
fieldset
- textfield02
fieldset
add textfield
submit button
so, everytime add textfield pressed, it will add new/duplicate textfield02.
with add textfield code as follow:
$form['fields']['modules']['add'] = array(
'#type' => 'submit',
'#name' => 'addtextfield',
'#value' => t('Add more TextField'),
'#submit' => array(array($this, 'addTextfieldSubmit')),
'#ajax' => array(
'callback' => array($this, 'addTextFieldCallback'),
'wrapper' => 'wrapper',
'effect' => 'fade',
),
);
the adding field is working fine, the only problem i have here is: because textfield00 and textfield01 is mandatory, if i pressed add button, it will send me an error message 'mandatory fields' before i can add new textfield.
so how can i 'bypass' the requried validation, everytime i press add textfiled and only validate 'required = true' when i press submit button.
Thank You, AnD