Forums

Beta v3.0: resetting form after republishing form values

level420 05 Aug, 2008
Hello Everybody!

I'm using servers side validation in my form where the field values are republished via HTML-code like this:


<input type="text" name="email" value="<?php echo $_POST['email']; ?>" />


If the form is reloaded in case of a validation error there is no chance to clear all field via a input type="reset" button, because the initial value, after the republished load, is not empty.

My idea was to have two submit buttons with different name. This way I could catch the case where the second submit button called "reset fields" was pressed. In this case I would be able to cleare the $_POST hash values of the form field which then should lead to cleared form field values.

Any other ideas on this problem?

Thank you for your help.
Max_admin 05 Aug, 2008
Hi level,

do you use the built in server side validation feature or yours ? a normal reset button will clear form fields any time without submitting the page!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 05 Aug, 2008
Hi Max,

The Reset button doesn't clear the fields - it restores the default values. If the default values have been reset because the form has been submitted then it will re-show the submitted values. A page refresh is probably needed to clear the values again.

In general this isn't a problem because when people get to submit they want to keep their values. But a second submit button with server side code to reset the default values to 'null' woudl do the trick.

Bob
Max_admin 05 Aug, 2008
Hi Bob,

Ok, I didn't observe this 😀

it needs some idea yes, I have some cold today, can't concentrate very well!

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
level420 06 Aug, 2008

Hi Bob,

Ok, I didn't observe this 😀

it needs some idea yes, I have some cold today, can't concentrate very well!

Max



Hi Max! I hope you feel better soon.

My idea was to have two submit buttons with different name attributes. This <input type="submit" name="reset"> button does a form submit where the submit is not processed but is used to set the form elements to their inial values.

In general I need a server based validation/processing solution because I can't rely on the browser having javascript enabled.

Coming from perl there is a module called HTML::FillInForm (http://search.cpan.org) which parses the form code via a html parser and processes the posted form values given into the html dom. After this the modified HTML form code is recreated based on the modified dom. This also works with radio buttons, checkboxes, select boxes etc. This also allows to reset all values to default.
Max_admin 06 Aug, 2008
Hi,

Thank you!! I understand you but I really have no idea now how to solve this if it will just load the initial values!

Best regards,

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.