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...
}
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>',
)),
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