2012-03-08 11 views
0

自分の設定ページを持つモジュールをまとめようとしています。そのために、私は私のメニューページ-コールバックとして次のコードを使用しています:ロングコード用Drupal 7 hook_menuチェックボックスの問題

function webform_customizations_customize() { 
    $form = array(); 
    // Text field for the e-mail subject. 
    $form['webform_customizations']['user_warn_e-mail_subject'] = array(

     '#type' => 'textfield', 
     '#title' => t('Warning e-mail subject'), 
     '#description' => t('The subject of the e-mail which will be sent 
    to users.'), 
      '#size' => 40, 
      '#maxlength' => 120, 
      '#required' => TRUE, 
    ); 
    $options = array('A', 'B', 'C'); 
    $form['test'] = array(
     '#type' => 'radios', 
     '#options' => array(
       'one' => t('one'), 
       'two' => t('two'), 
      ), 
     '#title' => t('roles that should see a minimal webforms setting area'), 
     '#title_display' => t('testing'), 
    ); 
    $form['high_school']['tests_taken'] = array(

    '#type' => 'checkboxes', 

    '#options' => drupal_map_assoc(array(t('SAT'), t('ACT'))), 
    '#title' => t('What standardized tests did you take?'), 
    '#states' => array(
     'visible' => array(// action to take. 
     ':input[name="student_type"]' => array('value' => 'high_school'), 
    ), 
    ), 
); 
return $form; 
} 

謝罪を。

私の問題は私の試みは、チェックボックスが失敗している表示することです。最初のフィールドには、テキストフィールドが正常に表示されます。しかし、次の2つは設定ページに表示されないチェックボックスです - そして、tests_takenチェックボックスのコードは修正なしでthis drupal doc pageから直接持ち上げられます。

私は、単一のチェックボックスを試してみましたが、それが動作します。

助けてください。

// This #states rule says that this checkboxes array will be visible only 
    // when $form['student_type'] is set to t('High School'). 
    // It uses the jQuery selector :input[name=student_type] to choose the 
    // element which triggers the behavior, and then defines the "High School" 
    // value as the one that triggers visibility. 

は、単に#states要素を削除し、それが動作するはずです:

答えて

0

は、あなたがかかったコードと一緒にいたコメントを読んだことがあるはずです。 幸せなdrupaling!

関連する問題