Adding a Time element is slightly different from adding any other element, there are three steps.
Pick a unique name for the element, choose a name for your new element that is not currently used by another element. The name should be all lower case and multiple words should be joined by an underscore. If this is the first Time element in your form a good name would be
Add the HTML for the form element in your web page. The easiest way to add another form element is to copy the existing HTML code for the element, including all surrounding wrappers. There is an example of the Time element HTML in the file example-all-elements.html. So to copy the entire element you would select the all the HTML code between the comments:
<!-- Begin Time element --> ... <!-- End Time element -->
Paste the HTML into your own form in the position you want.
Add the form element to the process.php file to make the PHP script aware of the new form element, you will need to edit the file quform/process.php. You will need to create a new Quform_Element_Time object for your new field, just copy the code below for the Time element (take from the file quform/process-all-elements.php).
$time = new Quform_Element_Time('time', 'Time');$time->addValidators(array('required', 'time')); $form->addElement($time);
$time = new Quform_Element_Time('time', 'Time'); $time->addValidators(array('required', 'time')); $form->addElement($time);
- On line 1, if your unique name from Step 1 is not
time, replace the text inside the single quotes
'time'with your unique name. It is important that this matches the first part of the
name=""attribute of the select elements in the HTML (before the [hour] and [minute] parts). This tells the PHP script what element you are referring to.