|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
QuickForm: Adding rule to element added via html
I'm using...
Code:
$form->addElement('html','<div id="foo"><input type="text" name="title" /> [more html and so on...]</div>');
In an effort to create a slick form with a date picker and nice layout. I'm have three text inputs (title, date, comments) added this way and I want all of them to be required. I've tried to add a rule the ordinary way but it doesnt work... Code:
$form->addRule('title','Please enter a title','required',false,'client');
How do I add a required rule to each of the three fields? |
|
#2
|
|||
|
|||
|
RE: QuickForm: Adding rule to element added via html
1. The 'html' element is deprecated. Use the 'static' element.
2. QF rules work only for elements that you add via QA, e.g. $form->addElement('text', 'title', ...); 3. A possible solution for your problem: Use a group (=> addGroup()) with (e.g.) a 'text' element (named 'title') and a 'static' element (with the calendar JS code as the value). 4. For "jscalendar" you can find two working implementations for QF via Google. One solution works as a group (but can be used as a element), the other one is a new element that has only the JS code and needs an additional 'date' (or 'text') element. |
|
#3
|
|||
|
|||
|
RE: QuickForm: Adding rule to element added via html
Sorted, thanks mate!
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PEAR Packages > QuickForm: Adding rule to element added via html |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|