【问题标题】:Is it possible to transfer an HTML form to a webform? Drupal是否可以将 HTML 表单传输到网络表单?德鲁巴
【发布时间】:2013-05-24 11:32:17
【问题描述】:

我已经制作了 HTML 表单并设置了样式,是否可以将其放入 Drupal 中的 web 表单中,而无需重新创建所有内容?我的意思是,是否可以通过 ids 和 classes 让 webform 模块接受提交的结果?

【问题讨论】:

    标签: html css drupal drupal-forms drupal-webform


    【解决方案1】:

    答案参差不齐。您可以在 html 表单中重复使用您已经完成的样式,但它不像在 drupal 中复制粘贴 html 表单那么简单。

    为此,您需要使用 drupal form api

    Drupal 6 表单示例:http://drupal.org/node/717734
    Drupal 7 表单示例:http://drupal.org/node/717740

    Drupal 6 字段示例:

    $form['title'] = array(
      '#type' => 'textfield',
      '#title' => t('Page title'),
      '#attributes' => array(
        'class' => 'page-title', 
      ),
    );
    

    Drupal 7 字段示例:

    $form['title'] = array(
      '#type' => 'textfield',
      '#title' => t('Page title'),
      '#attributes' => array(
        'class' => array('page-title'), 
      ),
    );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-06
      • 2014-09-03
      • 2013-04-03
      相关资源
      最近更新 更多