RE: [PEAR] Template_flexy + QuickForm problem: hidden form fieldgets overwritten with bad value

From: Date: Sun, 03 Aug 2003 20:54:12 +0000
Subject: RE: [PEAR] Template_flexy + QuickForm problem: hidden form fieldgets overwritten with bad value
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-6979@lists.php.net to get a copy of this message
Bertrand, Thanks very much for the tip. If nothing else works, I'll do something like that, probably just change the variable name. I was just hoping that I could more directly address the problem, rather than code around it. If that's not possible, though, it's not the end of the world. Could someone point me to the method or methods responsible for rewriting current request variables into form field default values? Even if I can't change the behavior, I'd like to know what is actually going on, as I expect to use QuickForm much more in the near future. I couldn't find anything in the documentation or in my first skim over the QF code. Thanks again, Andy > -----Original Message----- > From: Bertrand Mansion [mailto:bmansion@mamasam.com] > Sent: Saturday, August 02, 2003 4:05 AM > To: Andy Crain; pear-general@lists.php.net > Subject: Re: [PEAR] Template_flexy + QuickForm problem: hidden form > fieldgets overwritten with bad value > > <crain@fuse.net> wrote : > > > I am using DataObject and Template_flexy together and am having a > > problem with-I think-Template_flexy's internal calls to QuickForm. Not > > being very familiar with QuickForm I can't say that for certain, but > > here's what's happening: > > > > > > > > In a template file, e.g. index.html, I have hard-coded in HTML a basic > > form (method=get) that contains a hidden form field named "search". In > > addition, I have several links on this page that also pass a variable > > called "search", but with different values from the form's search > > variable. In my main script, e.g. index.php, I use a switch statement, > > e.g. switch ($_GET['search']) {case 'link_clicked': do X; break; case > > 'form_submitted': do Y; break;} to build queries differently depending > > on whether a user clicked a link or submitted the form. Now here's the > > problem: Everything works fine until I (1) click a link, passing > > $_GET['search']=link_clicked to index.php and reloading the page with > > the appropriate query results, and then (2) submit the form, which > > should pass $_GET['search']=form_submitted. The problem is that > > QuickForm-I think-is taking my hidden form field, which is hard-coded in > > the template as <input type="hidden" name="search" > > value="form_submitted">, and rewriting it with the $_GET['search'] value > > from the previous request, so it now appears in the source as <input > > type="hidden" name="search" value="link_clicked">. Of > > course, submitting > > the form now wreaks all sorts of havoc on the script, as the switch > > statement thinks it's processing for $_GET['search']=link_clicked but > > has all the wrong variables, i.e. the variables that accompany post > > requests. > > > > > > > > Again, I'm not certain where the problem lies, but that's why I'm > > writing, after more than half a day looking through QuickForm and trying > > to figure out what's going on. Can anyone tell me if I'm on the right > > track, or better, tell me how to stop my hidden form field value from > > being overwritten? Is there some config setting or flag I can use to > > tell Template_flexy not to call QuickForm, or to tell QuickForm to lay > > off my simple little form-without modifying the base classes? > > Hi, > Use POST for your form or change the hidden field name, that should make > it. > > Bertrand Mansion > Mamasam

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