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.

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~

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.