Re: Question Regarding HTML_QuickForm

From: Date: Wed, 24 Dec 2003 08:10:22 +0000
Subject: Re: Question Regarding HTML_QuickForm
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-9814@lists.php.net to get a copy of this message
I figured out how to add client side as well as server side rule. I have to add two rules : $form->addRule('MyTextBox', 'Your name is required', 'required','','client'); $form->addRule('MyTextBox', 'Your name is required', 'required','','server'); Can anybody explain me how to make use of server side validation (Point no 1) when method is post and action is done by using some other php script? Thanks Sanjay ----- Original Message ----- From: "Sanjay" <sanjay92@hotmail.com> To: <pear-general@lists.php.net> Sent: Tuesday, December 23, 2003 11:17 PM Subject: [PEAR] Question Regarding HTML_QuickForm > 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 >

« previous php.pear.general (#9814) next »