Confirm My Form

[Total: 0    Average: 0/5]

This script shows how to validate and confirm perticular form items.

Body Code:

<SCRIPT language=JavaScript> 
<!-- 
function validate(_frm) { 
    // 
    // Build the form data 
    // 
	var _f="Here is the form data you entered:";
	var _l="Do you want to submit this data?";
	var _n="n";
    var _fd="";
    _fd += "First Name: " + _frm.first.value  + _n;
    _fd += "Last Name:  " + _frm.last.value   + _n;
    _fd += "Nickname:   " + _frm.nick.value   + _n;
    _fd += "Stage Name: " + _frm.stage.value  + _n;
	for(var i=0;i<_frm.intro.length;i++)
	  if(_frm.intro[i].checked)
	    _fd += "Yes/No:     " + _frm.intro[i].value  + _n;
	for(var i=0;i<_frm.num.length;i++)
	  if(_frm.num[i].checked)
        _fd += "How Many:   " + _frm.num[i].value + _n;
	
    // 
    // Show the data to the user 
    // 
    return confirm(_f+_n+_n+_fd+_n+_l);
} 
//--> 
</SCRIPT> 
----------------------- 

    <FORM name=frmNames onsubmit="return validate(document.frmNames)"  action=/scripts/formtest.asp method=post> 
      <H3>Please tell me about yourself:</H3>First Name: <INPUT name=first value="test FIRST"> 
      <P>Last Name: <INPUT name="last" value="test LAST"> 
      <P>Nickname: <INPUT name="nick" value="test NICK"> 
      <P>Stage Name: <INPUT name="stage" value="test STAGE"> 

<!-- //------------------how cofirm next---//--> 
<P>Are you want?<br> 
Yes:<input  name="intro" type=radio value="yes" checked> 
No<input  name="intro" type=radio value="no"> 
<P>How many?<br> 
One:<input  name="num" type=radio value="one">
Two<input name="num" type=radio value="two" CHECKED> 
Three<input  name="num" type=radio value="three"> 
<!-- //-------------------//--> 

      <P><INPUT type=submit value="Just Do It!"> <INPUT type=reset value="Just 
Reset It!"> </FORM> 

Times Viewed: 5

Leave a Reply

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