Filling Text Boxes for Testing


It is often required to fillin the form on webpage so you can test the form submission action. For this I often need to put different value so I can recognize the values are coming good. Like I need to create PDF on the fly, In that I need to fill the form on web page than generate the PDF as per data in web form, this consist of 30 field, so To place each field data correctly I need to fill the form again and again. Though data validation is not required and not there. But still to check if need data to be transfer.

  So, I add this small JS code to do that for me, within body tag

for (i = 0; i < document.forms[0].elements.length; i++)

{

  if (document.Form1.elements[i].type == “text”)

{

document.Form1.elements[i].value = document.Form1.elements[i].name;

}

}

That solve my problem…

, ,