Hello Everybody!
I'm using servers side validation in my form where the field values are republished via HTML-code like this:
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.
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.
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
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
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
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
Hi Bob,
Ok, I didn't observe this 😀
it needs some idea yes, I have some cold today, can't concentrate very well!
Max
Ok, I didn't observe this 😀
it needs some idea yes, I have some cold today, can't concentrate very well!
Max
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.
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
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
This topic is locked and no more replies can be posted.