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;
}
죄송합니다.
제 문제는 확인란을 표시하려는 시도가 실패했기 때문입니다. 첫 번째 필드는 텍스트 필드를 성공적으로 보여줍니다. 하지만 다음 두 가지는 내 구성 페이지에 표시되지 않는 체크 박스입니다. 그리고 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 요소를 제거하고 작동해야합니다