Below is an example of code that makes the first field not required in the form

    function мой_модуль_form_alter(&$form, &$form_state, $form_id){
    $form['field_website']['und'][0]['#required'] = FALSE;


But I need to check the content in the second field after sending the form, and if it coincides with the value of "test", then the first field became not required.

    $form['field_website']['und'][0]['#required'] = FALSE;

Use Conditional Fields module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.