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

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

          <bdo id='OS88O'></bdo><ul id='OS88O'></ul>

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

        在 drupal 中使用 hook_form_alter 设置 webform 组件值

        set webform component value using hook_form_alter in drupal(在 drupal 中使用 hook_form_alter 设置 webform 组件值)
          <bdo id='gPx3F'></bdo><ul id='gPx3F'></ul>
          <legend id='gPx3F'><style id='gPx3F'><dir id='gPx3F'><q id='gPx3F'></q></dir></style></legend>
              <i id='gPx3F'><tr id='gPx3F'><dt id='gPx3F'><q id='gPx3F'><span id='gPx3F'><b id='gPx3F'><form id='gPx3F'><ins id='gPx3F'></ins><ul id='gPx3F'></ul><sub id='gPx3F'></sub></form><legend id='gPx3F'></legend><bdo id='gPx3F'><pre id='gPx3F'><center id='gPx3F'></center></pre></bdo></b><th id='gPx3F'></th></span></q></dt></tr></i><div id='gPx3F'><tfoot id='gPx3F'></tfoot><dl id='gPx3F'><fieldset id='gPx3F'></fieldset></dl></div>
                  <tbody id='gPx3F'></tbody>
                <tfoot id='gPx3F'></tfoot>

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

                  本文介绍了在 drupal 中使用 hook_form_alter 设置 webform 组件值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我已经使用 form_alter 函数来更改组件的值,但它不会更改并且默认值存储在数据库中.当我打印 $form 时,更新的值正在显示但未保存在 db 中.

                  I have used form_alter function to change the value of a component but it does not change and default values is stored in the db. when i print the $form the updated values is displaying but not saved in db.

                   <?php 
                  function pahcom_form_edit_module_form_alter(&$form, &$form_state, $form_id) {   
                          if($form_id =='webform_client_form_54')
                          {           
                              $new_value = rand(100000,10000000);
                              $form['#node']->{'webform'}['components']['12']['value']=$new_value;            
                  
                          }
                  }
                  
                  ?>
                  

                  推荐答案

                  工作代码

                  <?php 
                  function pahcom_form_edit_module_form_alter(&$form, &$form_state, $form_id) {   
                          if($form_id =='webform_client_form_54')
                          {           
                              $new_value = rand(100000,10000000);
                              $form['submitted']['vendor_id']['#default_value']=$new_value;               
                          }
                  }
                  
                  ?>
                  

                  这篇关于在 drupal 中使用 hook_form_alter 设置 webform 组件值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  How do I pass parameters into a PHP script through a webpage?(如何通过网页将参数传递给 PHP 脚本?)
                  PHP - include a php file and also send query parameters(PHP - 包含一个 php 文件并发送查询参数)
                  Where can I read about conditionals done with quot;?quot; and quot;:quot; (colon)?(我在哪里可以阅读有关使用“?完成的条件的信息?和“:(冒号)?)
                  Accessing arrays whitout quoting the key(在不引用键的情况下访问数组)
                  What is the name for the quot;lt;lt;lt;quot; operator?(“lt;lt;lt;的名字是什么?操作员?)
                  default as first option in switch statement?(默认为 switch 语句中的第一个选项?)
                  • <bdo id='QfMka'></bdo><ul id='QfMka'></ul>

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

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

                    <legend id='QfMka'><style id='QfMka'><dir id='QfMka'><q id='QfMka'></q></dir></style></legend>
                      <tbody id='QfMka'></tbody>

                          1. <tfoot id='QfMka'></tfoot>