0

Hi ,

I am new to perl language,while i am working with this i got a small problem.
I designed a form in html it contains four fields. when the user clicks submit button in this form i redirecte my page to serverside code which is perl.
In this i am getting the values from and isserted those values into the data base.but my problem is if i return back to the html form the values entered into the textfields are not cleared.how can i clear textfield values in perl or html.I have to rectify this problem for providing security to myform.
How can i do this.

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by rdxblast
0

divyareddy.533,

The problem is you should not reset the values of the form until you have submitted the form values. By the time you submit the form it will be redirected to someother page. You have said that the page redirects to server side code.

A javascript is enough to reset the fields. Call the javascript onsubmit of the form and your javascript will be a onliner to clear your form values. Like:

document.getElementById[formname].reset or document.[your_form_name].reset()

example: document.getElementById('formrecord').reset() or document.formrecord.reset()

so basically, your JS function will look like this:

function clearme() {
document.formrecord.reset();
// where 'formrecord' is the name of your form
}

Thanks,
~RDX~

Edited by rdxblast: send accidentally before completing

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.