tags:

views:

30

answers:

2

I have a small form of 4 fields, I am using Ajax to save record and give alert to user on same page. all is working fine but I want to clear all 4 fields after record is inserted and don't want user to press again and duplicate,

Right now I am using

this._studentName.text = "";

but is there any easy method to get same result coz I have another form where there are more then 40 fields and don't want write .text = "" 40 times

+1  A: 

If you use jQuery then you could write:

$('#formID input[type=text]').val('');

If you don't use jQuery then you could still call this.getElementsByTagName('input') and loop through the results to clear the values.

Xavier Poinas
+1  A: 

If it's applicable, Why not redirect to the same page? :)

Shady M. Najib