Drupal: How to Render Results of Form on Same Page as Form

前端 未结 5 1768
走了就别回头了
走了就别回头了 2020-12-10 07:31

How would I print the results of a form submission on the same page as the form itself?

Relevant hook_menu:

    $items[\'admin/content/ncbi_subsites/         


        
5条回答
  •  不知归路
    2020-12-10 07:46

    The key information in the link Nikit posted is $form_state['rebuild']. Here's some info from Drupal 7 documentation that I believe applies the same for Drupal 6...

    $form_state['rebuild']: Normally, after the entire form processing is completed and submit handlers ran, a form is considered to be done and drupal_redirect_form() will redirect the user to a new page using a GET request (so a browser refresh does not re-submit the form). However, if 'rebuild' has been set to TRUE, then a new copy of the form is immediately built and sent to the browser; instead of a redirect. This is used for multi-step forms, such as wizards and confirmation forms. Also, if a form validation handler has set 'rebuild' to TRUE and a validation error occurred, then the form is rebuilt prior to being returned, enabling form elements to be altered, as appropriate to the particular validation error.

提交回复
热议问题