Confirm All Form Data

[Total: 0    Average: 0/5]

This script shows all data in a form in a confirm box.

Body Code:

function validateForm(_f) {
	var _b="Here is the form data you entered:";
	var _l="Do you want to submit this data?";
	var _n="n";
	var _t="t";
    var _s="";
    for(var _obj = _f.firstChild; _obj ; _obj=_obj.nextSibling)
		 * Pick up the title if it exists - otherwise use the name of the object.
		 * Deal with Text and Hidden and TextArea
		if(_obj.type=="text" || _obj.type=="hidden" || _obj.type=="textarea")
		 * Deal with Radio Buttons, and Checkboxes
		 * Deal with Select Boxes
		var _regExp=/select/i;
    return confirm(_b+_n+_n+_s+_n+_l);

<FORM name=f1 onsubmit="return validateForm(document.f1)">
<input type=text name=t1 header="Value Text 1" value="text 1">
<input type=text name=t2 header="Value Text 1" value="text 2">
<input type=text name=t3 value="text 3">
<input type=hidden name=h1 header="Value Text 1" value="hidden 1">
<input type=hidden name=h2 header="Value Text 1" value="hidden 2">
<input type=hidden name=h3 value="hidden 3">
1A<input type=radio name=r1 header="Value Radio 1-A" value="radio 1-A" checked>
1B<input type=radio name=r1 header="Value Radio 1-B" value="radio 1-B">
1C<input type=radio name=r1 header="Value Radio 1-C" value="radio 1-C">
2A<input type=radio name=r2 header="Value Radio 2-A" value="radio 2-A">
2B<input type=radio name=r2 header="Value Radio 2-B" value="radio 2-B" checked>
2C<input type=radio name=r2 header="Value Radio 2-C" value="radio 2-C">
3A<input type=radio name=r3 value="radio 3-A">
3B<input type=radio name=r3 value="radio 3-B">
3C<input type=radio name=r3 value="radio 3-C" checked>
<select name=s1>
  <option value="1-A" header="Value Select 1-A" SELECTED>1-A</option>
  <option value="1-B" header="Value Select 1-B">1-B</option>
  <option value="1-C" header="Value Select 1-C">1-C</option>
<select name=s2>
  <option value="2-A" header="Value Select 2-A">2-A</option>
  <option value="2-B" header="Value Select 2-B">2-B</option>
  <option value="2-C" header="Value Select 2-C" SELECTED>2-C</option>
<select name=s3>
  <option value="3-A">3-A</option>
  <option value="3-B" SELECTED>3-B</option>
  <option value="3-C">3-C</option>
1A<input type=checkbox name=c1 header="Value Checkbox 1-A" value="check 1-A">
1B<input type=checkbox name=c1 header="Value Checkbox 1-B" value="check 1-B">
1C<input type=checkbox name=c1 header="Value Checkbox 1-C" value="check 1-C" checked>
2A<input type=checkbox name=c2 header="Value Checkbox 2-A" value="check 2-A" checked>
2B<input type=checkbox name=c2 header="Value Checkbox 2-B" value="check 2-B">
2C<input type=checkbox name=c2 header="Value Checkbox 2-C" value="check 2-C">
3A<input type=checkbox name=c3 value="check 3-A">
3B<input type=checkbox name=c3 value="check 3-B" checked>
3C<input type=checkbox name=c3 value="check 3-C">
<textarea header="Value TextArea 1" name=ta1>Text Area 1</textarea>
<textarea header="Value TextArea 2" name=ta2>Text Area 2</textarea>
<textarea name=ta3>Text Area 3</textarea>
<INPUT type=submit value="Submit/Validate">


Times Viewed: 15

Leave a Reply

Your email address will not be published. Required fields are marked *