Skip to main content
added 175 characters in body
Source Link

@NabajitRoy my idea is

  1. Never use drupal_render()drupal_render() manual calls (return $form array as-is)
  2. Move all the form generation code into form constructor( create_report_form() ), AJAX callback should not create new elements for form but only create_report_form()create_report_form() should
  3. AJAX callbacks should only return element form (not generetegenerate them) e.g. return $form['attributes']['submit']$form['attributes']['submit'] and may be $form_state['rebuild'] = true;$form_state['rebuild'] = true; if needed.
  4. To know in create_report_form()create_report_form() if it was called by AJAX request button check the $form_state['triggering_element']$form_state['triggering_element'] in it.
  5. I feel that using '#type' => 'submit''#type' => 'submit' instead of '#type' => 'button''#type' => 'button' is better

https://www.drupal.org/node/752056 https://www.drupal.org/node/752056

@NabajitRoy my idea is

  1. Never use drupal_render() manual calls (return $form array as-is)
  2. Move all the form generation code into form constructor, AJAX callback should not create new elements for form but only create_report_form() should
  3. AJAX callbacks should only return element form (not generete them) e.g. return $form['attributes']['submit'] and may be $form_state['rebuild'] = true; if needed.
  4. To know in create_report_form() if it was called by AJAX request button check the $form_state['triggering_element'] in it.
  5. I feel that using '#type' => 'submit' instead of '#type' => 'button' is better

@NabajitRoy my idea is

  1. Never use drupal_render() manual calls (return $form array as-is)
  2. Move all the form generation code into form constructor( create_report_form() ), AJAX callback should not create new elements for form but only create_report_form() should
  3. AJAX callbacks should only return element form (not generate them) e.g. return $form['attributes']['submit'] and may be $form_state['rebuild'] = true; if needed.
  4. To know in create_report_form() if it was called by AJAX request button check the $form_state['triggering_element'] in it.
  5. I feel that using '#type' => 'submit' instead of '#type' => 'button' is better

https://www.drupal.org/node/752056 https://www.drupal.org/node/752056

Source Link

@NabajitRoy my idea is

  1. Never use drupal_render() manual calls (return $form array as-is)
  2. Move all the form generation code into form constructor, AJAX callback should not create new elements for form but only create_report_form() should
  3. AJAX callbacks should only return element form (not generete them) e.g. return $form['attributes']['submit'] and may be $form_state['rebuild'] = true; if needed.
  4. To know in create_report_form() if it was called by AJAX request button check the $form_state['triggering_element'] in it.
  5. I feel that using '#type' => 'submit' instead of '#type' => 'button' is better