Display error message on Ajax form submit Drupal 7

Display error message on Ajax form submit Drupal 7


To Display error message after ajax form submit you need to take care the following points.



 $form['submit_button'] = array(  
     '#type' => 'submit',  
     '#value' => t('Save'),  
     '#ajax' => array(  
       'callback' =>'form_ajax_callback'  
       'wrapper' => form-html-id-name ,  
       'event' => 'click',  
     )  
   );  


In the wrapper you should take the form-id.
For example if your form name is abc_form then generated html form id will be abc-from. Otherwise errors will not get displayed.

Comments

Popular Posts