Below is an example of code that makes the first field optional in the form itself.

<?php function мой_модуль_form_alter(&$form, &$form_state, $form_id){ $form['field_website']['und'][0]['#required'] = FALSE; //вот так поле становится необязательным для заполненияв самой форме } ?> $form['test']['und'][0]['value']=test; 

But it is necessary for me that after the form is submitted, the content is checked in another field, and if it matches the desired value of "test", then the first field becomes optional.

 if($form['test']['und'][0]['value']=='test'){ $form['field_website']['und'][0]['#required'] = FALSE; } 

I tried to use function form_submit but I don’t even know if this or that, but it didn’t affect the form submission.

    0