Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

reset form fields

Links for php scripts

Moderators: macek, egami, gesf

reset form fields

Postby flashsparrow » Tue Aug 07, 2012 1:40 pm


i'm creating a website and i have a registration form.i have created the validation messages and i want to create a reset button.the problem is if the user click the submit button and there is an error in the form, a message will be displayed next to the appropriate field and the fields whick have already filled will remain filled.then if the user click the reset button the fields does not clear.any ideas how can i do the fields to clear after a submit?

New php-forum User
New php-forum User
Posts: 1
Joined: Tue Aug 07, 2012 1:35 pm

Re: reset form fields

Postby freshnet » Wed Aug 08, 2012 4:58 am

I would say you're probably better off doing this with jquery. For example, you could modify the inner text of the form elements to clear it when the button is clicked. This code is just an example, and would clear all input boxes when run.

Code: Select all
       $("#reset").click(function() {
User avatar
php-forum Active User
php-forum Active User
Posts: 278
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.