Re: HTML_QuickForm | putting 'submit' and 'reset' in a group
| From: | Jeff MacDonald | Date: | Tue, 09 Dec 2003 10:28:31 +0000 |
| Subject: | Re: HTML_QuickForm | putting 'submit' and 'reset' in a group | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9401@lists.php.net to get a copy of this message | ||
On Tue, Dec 09, 2003 at 09:33:46AM +0100, Bertrand Mansion wrote:
> > greetings,
> >
> > for layout purposes, I'd like to have the 'submit' and 'reset'
> > buttons in a
> > group so they are displayed next to each other instead of on seperate lines.
> >
> > -- snip --
> > $group = array();
> > $group[] = &HTML_QuickForm::createElement("submit",
> > "submit", "submit");
> > $group[] = &HTML_QuickForm::createElement("reset", "reset",
> > "reset");
> > $form->addGroup($group);
> > -- snip --
> >
> > the problem is that when I click the 'reset' button, the form actually
> > *submits*.. is there something I need to check for in the code to trap this?
> > when I click reset, I expect it to 'undo' my changes, but certainly not to
> > submit the form.
> >
> > is there an example someplace that I can look at?
>
> Your code works for me.
> What does the generated html looks like ?
>
> Bertrand Mansion
> Mamasam
>
thanks for the quick reply :)
the code "works" ok, but as I said, it appears to be submitting the form
instead of letting the browser reset the fields.. so when I click reset, my
code does the 'process' phase, which is not what I expect. I am willing to
make a mod to trap this, but I am not quite sure how to do so.
here is the html that gets generated:
-- snip --
<label><br />
<input name="submit" value="submit" type="submit" />
<input name="reset" value="reset" type="reset" />
</label><br />
-- snip --
maybe I should check to see if a field named 'reset' exists and with what
value before I process the form?
regards,
J