下拉并确认问题 [英] Drop Down and confirm problems
问题描述
你好,
我目前正在构建一些表格,并且需要你们的帮助,因为我不知道该怎么做;/.
所以:
1.我尝试过使用确认对话框.我正在使用jformer,这是一个很好的表单框架,尽管文档缺少信息.该表单是使用类和函数完全构建的.
提交时具有以下功能.
Hi there,
I''m currently building some forms and would require some help from you guys as I don''t know what to do more ;/.
So:
1. I''ve tried working with the confirm dialogue box. I am using jformer, a form framework which is quite nice though documentation is lacking information. The form is completely built using classes and functions.
There is the following function on submission.
function onSubmit($formValues)
{
$formValues = $formValues->registrationPage->registrationSection1;
$studentID = $formValues->studentid;
etc...
}
有没有一种方法可以在提交时按确认插入javascript?这样我就可以进行确认对话,并根据用户按下的是(是/否),我有一个if语句执行应做的事情(即,在我的情况下,提交数据/删除)
2. jformer框架中的触发器.
我想单击一个下拉列表,它显示另一个下拉列表.我尝试了以下操作,但是仅通过使用复选框,我不知道如何使用下拉菜单进行操作:
Is there a way to insert a javascript confirm on submition is pressed? So that I have a confirmation dialogue and according to which the user pressed (Yes / No) I have an if statement doing what is supposed to do (ie the submission of data / deletion in my case)
2. Triggers in the jformer framework.
I would like to have a drop down list which on click, it shows another drop down list. I have tried the following but only with the use of a checkbox, I have no clue on how to do it with a drop down:
new JFormComponentMultipleChoice('selectGroup2', '', array(
array('value' => 'secondGrp', 'label' => 'Student has second group?'),
),
array()),
new JFormComponentDropDown('group2', 'Group 2:', $groups2array,
array(
'validationOptions' => array('required'),
'dependencyOptions' => array(
'dependentOn' => 'selectGroup2',
'display' => 'hide',
'jsFunction' => '$("#selectGroup2-choice1").is(":checked");'
),
)),
从上面可以看到,该函数检查该复选框是否已选中,如果未选中,则隐藏.
我需要一个下拉列表,而不是一个复选框.第一个下拉菜单显示新的下拉菜单,该下拉菜单根据用户选择的内容显示数据.
我已经发现如何使用以下方法从数据库中填充下拉列表:
As you can see from the above, the function checks if the checkbox is checked and is hidden if not checked.
I need a dropdown instead of a checkbox. The first dropdown displays the new drop down showing data according to what the user selected.
I allready found out how to populate the drop down from the database by using the following:
$query = "SELECT * FROM course";
$resultset = $db->query($query);
$coursearray = array();
array_push($coursearray, array ('value' => '','label' => ' - Select an Option - ','selected' => true));
while ($row = mysql_fetch_array($resultset))
{
array_push($coursearray, array ('value' => $row["course_ID"], 'label' => $row["course_Name"],));
}
填充数组后,我使用以下命令填充下拉列表:
after the array is populated, I use the following to populate the dropdown:
new JFormComponentDropDown('course', 'Course:', $coursearray,
array(
'validationOptions' => array('required')
),
array(
'tip' => '<p>Select Course</p>',
)),
我知道我提出的要求要多一些,但是我几乎尝试了所有可能的事情,并花了几天的时间研究某些东西的工作原理.非常感谢您的帮助,我将捐出一些小钱给谁来帮助我找到解决方案!
谢谢,
Francesco
I know I am asking a bit more then I should but I tried almost everything I could and spent days of research on how certain stuff works. Your help is much appreciated and I would donate something small to whom helps me find a solution to these!
Thanks,
Francesco
推荐答案
formValues) {
formValues) {
formValues =
formValues =
formValues-> registrationPage-> registrationSection1;
formValues->registrationPage->registrationSection1;
这篇关于下拉并确认问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!