Javascript Drupal弹出窗口返回值
我想要一个弹出窗口,用户可以在其中选择2个选项。当用户选择选项1时,表单['loading_type']必须具有加载类型A的值,否则它将获得加载类型B的值。 我使用Drupal6作为CMS,PHP作为表单,Javascript作为弹出窗口 这可能会有所帮助,但下面是我的代码片段:Javascript Drupal弹出窗口返回值,javascript,drupal,Javascript,Drupal,我想要一个弹出窗口,用户可以在其中选择2个选项。当用户选择选项1时,表单['loading_type']必须具有加载类型A的值,否则它将获得加载类型B的值。 我使用Drupal6作为CMS,PHP作为表单,Javascript作为弹出窗口 这可能会有所帮助,但下面是我的代码片段: $form['loading_type'] = array( '#type' => 'hidden', ); $form['submit'] = array( '#type' => 'submit'
$form['loading_type'] = array(
'#type' => 'hidden',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
'#attributes' => array('class' => 'accountability-button-confirm'),
);
$(document).ready(
function(){
$('.accountability-button-confirm').click(
function(){
return Drupal.popups.open(
Drupal.t('Loading Type:'),
Drupal.t("Please choose loading type."),
{
'Yes': {
title: Drupal.t('Loading Type A'),
func: function(){
Drupal.popups.close();
document.getElementById("loading_type").value = "Loading Type A";
$("form#name-of-my-from-form").submit();
}
},
'No': {
title: Drupal.t('Loading Type B'),
func: function(){
Drupal.popups.close();
document.getElementById("loading_type").value = "Loading Type B";
$("form#name-of-my-from-form").submit();
}
},
400
);
}
请帮忙。我是一个Drupal新手。非常感谢