I'm looking for solution for following scenario in my D7 site. I have form with 2 empty text fields. If user enters value in field 1 and submits form next time when he opens this form only field 2 will be available for input.

1 Answer 1


you can achieve it with some code in your custom module

function yourmodule_form_alter(&$form, &$form_state, $form_id)
    if ($form_id == 'your_form_id' ) { // in your custom content type 
    if($form["nid"]["#value"]){  //when we are in edit form
      if(isset($form['field_your_field1']['und'][0]['#default_value']['value']) )
     if(isset($form['field_your_field2']['und'][0]['#default_value']['value']) )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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