<i id='gaHZx'><tr id='gaHZx'><dt id='gaHZx'><q id='gaHZx'><span id='gaHZx'><b id='gaHZx'><form id='gaHZx'><ins id='gaHZx'></ins><ul id='gaHZx'></ul><sub id='gaHZx'></sub></form><legend id='gaHZx'></legend><bdo id='gaHZx'><pre id='gaHZx'><center id='gaHZx'></center></pre></bdo></b><th id='gaHZx'></th></span></q></dt></tr></i><div id='gaHZx'><tfoot id='gaHZx'></tfoot><dl id='gaHZx'><fieldset id='gaHZx'></fieldset></dl></div>
      <bdo id='gaHZx'></bdo><ul id='gaHZx'></ul>
    <tfoot id='gaHZx'></tfoot>
  1. <small id='gaHZx'></small><noframes id='gaHZx'>

    1. <legend id='gaHZx'><style id='gaHZx'><dir id='gaHZx'><q id='gaHZx'></q></dir></style></legend>

      Drupal:如何在与表单相同的页面上呈现表单的结果

      Drupal: How to Render Results of Form on Same Page as Form(Drupal:如何在与表单相同的页面上呈现表单的结果)
    2. <tfoot id='aYLvM'></tfoot>

        <i id='aYLvM'><tr id='aYLvM'><dt id='aYLvM'><q id='aYLvM'><span id='aYLvM'><b id='aYLvM'><form id='aYLvM'><ins id='aYLvM'></ins><ul id='aYLvM'></ul><sub id='aYLvM'></sub></form><legend id='aYLvM'></legend><bdo id='aYLvM'><pre id='aYLvM'><center id='aYLvM'></center></pre></bdo></b><th id='aYLvM'></th></span></q></dt></tr></i><div id='aYLvM'><tfoot id='aYLvM'></tfoot><dl id='aYLvM'><fieldset id='aYLvM'></fieldset></dl></div>
          <tbody id='aYLvM'></tbody>

            • <bdo id='aYLvM'></bdo><ul id='aYLvM'></ul>

            • <legend id='aYLvM'><style id='aYLvM'><dir id='aYLvM'><q id='aYLvM'></q></dir></style></legend>

              <small id='aYLvM'></small><noframes id='aYLvM'>

                本文介绍了Drupal:如何在与表单相同的页面上呈现表单的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                如何将表单提交的结果打印在与表单本身相同的页面上?

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

                相关钩子菜单:

                    $items['admin/content/ncbi_subsites/paths'] = array(
                        'title' => 'Paths',
                        'description' => 'Paths for a particular subsite',
                        'page callback' => 'ncbi_subsites_show_path_page',
                        'access arguments' => array( 'administer site configuration' ),
                        'type' => MENU_LOCAL_TASK,
                    );
                

                页面回调:

                function ncbi_subsites_show_path_page() {
                  $f = drupal_get_form('_ncbi_subsites_show_paths_form');
                  return $f;
                }
                

                表单构建功能:

                   function _ncbi_subsites_show_paths_form() {
                      // bunch of code here
                
                      $form['subsite'] = array(
                        '#title' => t('Subsites'),
                        '#type' => 'select',
                        '#description' => 'Choose a subsite to get its paths',
                        '#default_value' => 'Choose a subsite',
                        '#options'=> $tmp,
                      );
                
                      $form['showthem'] = array(
                        '#type' => 'submit',
                        '#value' => 'Show paths',
                        '#submit' => array( 'ncbi_subsites_show_paths_submit'),    
                      );
                
                      return $form;
                    }
                

                提交函数(为了简洁跳过了验证函数)

                Submit function (skipped validate function for brevity)

                function ncbi_subsites_show_paths_submit( &$form, &$form_state ) {
                  //dpm ( $form_state );
                  $subsite_name = $form_state['values']['subsite'];
                  $subsite = new Subsite( $subsite_name ); //y own class that I use internally in this module
                  $paths = $subsite->normalized_paths;
                
                  // build list
                  $list = theme_item_list( $paths );
                }
                

                如果我打印那个 $list 变量,它正是我想要的,但我不确定如何将它放入带有从ncbi_subsites_show_path_page"构建的原始表单页面的页面中.非常感谢任何帮助!

                If I print that $list variable, it is exactly what I want, but I am not sure how to get it into the page with the original form page built from 'ncbi_subsites_show_path_page'. Any help is much appreciated!

                推荐答案

                Nikit 发布的链接中的关键信息是 $form_state['rebuild'].以下是 Drupal 7 文档中的一些信息,我认为这些信息同样适用于 Drupal 6...

                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']: 通常在整个表单处理完成并提交处理程序运行,一个表单是被认为是完成和drupal_redirect_form() 将重定向用户使用 GET 访问新页面请求(因此浏览器刷新不会重新提交表格).然而,如果'rebuild' 已设置为 TRUE,然后表格的新副本立即构建并发送到浏览器;反而的重定向.这用于多步骤形式,例如向导和确认表格.另外,如果一个表格验证处理程序已设置重建"为 TRUE 和验证错误发生,然后重新构建表单在退回之前,启用表格要更改的元素,视情况而定到特定的验证错误.

                $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.

                这篇关于Drupal:如何在与表单相同的页面上呈现表单的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                      • <bdo id='QnEwn'></bdo><ul id='QnEwn'></ul>
                        <legend id='QnEwn'><style id='QnEwn'><dir id='QnEwn'><q id='QnEwn'></q></dir></style></legend>

                        <i id='QnEwn'><tr id='QnEwn'><dt id='QnEwn'><q id='QnEwn'><span id='QnEwn'><b id='QnEwn'><form id='QnEwn'><ins id='QnEwn'></ins><ul id='QnEwn'></ul><sub id='QnEwn'></sub></form><legend id='QnEwn'></legend><bdo id='QnEwn'><pre id='QnEwn'><center id='QnEwn'></center></pre></bdo></b><th id='QnEwn'></th></span></q></dt></tr></i><div id='QnEwn'><tfoot id='QnEwn'></tfoot><dl id='QnEwn'><fieldset id='QnEwn'></fieldset></dl></div>
                            <tbody id='QnEwn'></tbody>

                          <small id='QnEwn'></small><noframes id='QnEwn'>

                          <tfoot id='QnEwn'></tfoot>