Drupal Forms - 设置默认值

发布于 2024-08-22 17:27:06 字数 126 浏览 4 评论 0原文

我正在使用 Drupal 6 的 webform 模块,并且希望在创建 webform 时为其确认消息设置默认值。每当用户创建新的网络表单时,我是否必须创建自己的模块来设置此表单值?或者我是否必须实现一个特殊的钩子来查找何时创建网络表单?

I am using the webform module for Drupal 6 and would like to set a default value for the confirmation message of the webform whenever it is created. Would I have to create my own module to set this form value whenever a user creates a new webform? Or would I have to implement a special hook to look for when a webform is created?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

请帮我爱他 2024-08-29 17:27:06

您将需要使用以下内容:

customMod_form_alter(&$form, $form_state, $form_id){ 
  if($form_id == 'webform_node_form'){ 
    $form['id_of_conf_message_field']['#default_value'] = 'BLAH BLAH'
  }
}

You going to want to use the following:

customMod_form_alter(&$form, $form_state, $form_id){ 
  if($form_id == 'webform_node_form'){ 
    $form['id_of_conf_message_field']['#default_value'] = 'BLAH BLAH'
  }
}
软甜啾 2024-08-29 17:27:06

@esafwan ..我不确定这是否对您解决隐藏字段问题有帮助,但是
我找到了默认变量值的链接 http://drupal.org/node/296453
所以我能够在已经存在的网络表单中使用默认值%request[key]创建一个隐藏字段并且工作完美..

@esafwan .. I'm not sure whether this shall help in your case with the hidden fields issue but
I found this link for default variable values http://drupal.org/node/296453
so I was able to create a hidden field in my already existent webform with default value %request[key] and worked perfectly ..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文