Question Regarding HTML_QuickForm
| From: | Sanjay | Date: | Wed, 24 Dec 2003 07:17:15 +0000 |
| Subject: | Question Regarding HTML_QuickForm | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9810@lists.php.net to get a copy of this message | ||
I have taken following example from HTML_QuickFrom Tutorial.
<?php
require_once "HTML/QuickForm.php";
$form = new HTML_QuickForm('frmTest', 'post','action.php');
$form->addElement('header', 'MyHeader', 'Testing QuickForm');
$form->addElement('text', 'MyTextBox', 'What is your name?');
$form->addElement('reset', 'btnClear', 'Clear');
$form->addElement('submit', 'btnSubmit', 'Submit');
$form->addRule('MyTextBox', 'Your name is required',
'required','','server');
if ($form->validate()) {
# If the form validates then freeze the data
$form->freeze();
}
$form->display();
?>
$ cat action.php
<?php print_r($_POST) ?>
1. I want to add rule for required field. This works ok, if I do client
validation. For server validation, when I hit Submit button, instructions
from action=action.php gets carried out and no validation is done. How to
make it work ?. I am probably missing something here so please help.
2. Is it possible to addRule so that it validates from client side as well
as server side as well. I mean to validation at both end. Is it possible.
Thanks
Sanjay