Re: Template_flexy + QuickForm problem: hidden form field gets overwritten with bad value
| From: | Bertrand Mansion | Date: | Sat, 02 Aug 2003 08:04:46 +0000 |
| Subject: | Re: Template_flexy + QuickForm problem: hidden form field gets overwritten with bad value | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-6951@lists.php.net to get a copy of this message | ||
<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