RE: [PEAR] [QUICKFORM] Javascript validation of two fields ormore...

From: Date: Fri, 29 Aug 2003 11:10:55 +0000
Subject: RE: [PEAR] [QUICKFORM] Javascript validation of two fields ormore...
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-7468@lists.php.net to get a copy of this message
> -----Original Message----- > From: Bertrand Mansion [mailto:bmansion@mamasam.com] > Sent: 24 August 2003 17:55 > > <carlesgp@yahoo.es> wrote : > > > Hi, > > > > I have two password fields in a form (one for the password an the > > other to confirm it). I'm trying to register in Quickform a > javascript > > validation function that compares the two fields, but i > can't achieve > > it. It seems like registerRule only accepts javascript > functions that > > treat with a single field of the form. > > > > Can anybody help me? > > Yes, it only works with a single field. But you can still > probably access the other field value if you hardcode the > object path: form.element.x or if you set the rule for a > group. This feature will maybe be added later as we have just > modified the way validation is done in QuickForm and this > might allow more possibilities. When I asked a similar question on this list quite recently I received a different answer: -- 8>< --- ... > > I've got two text fields on a Quickform and would like to ensure > > their > contents > > are equal upon submission. The twist is i want to do this test on > > the > client > > side, in javascript. > > > > How do i go about adding a javascript rule function to the > > Quickform? > > The same way as you add the server-side function... > 1) Write a JavaScript function for validation > 2) Register it via registerRule() > 3) Add a rule of this type with a 'client' modifier I never got it working in a flexible way, ie without hardcoded paths etc. I wanted to use the validation on a number of forms. How would the group things work? Regards, Mike c. ________________________________________________________________________ This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com ________________________________________________________________________

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