Login   Register  
PHP Classes
elePHPant
Icontem

File: ExampleJSFormValidation.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Md. Aminul Islam  >  Generate Javascript Validation  >  ExampleJSFormValidation.php  >  Download  
File: ExampleJSFormValidation.php
Role: Example script
Content type: text/plain
Description: Example JSForm Validation
Class: Generate Javascript Validation
Generate Javascript code for validation Web forms
Author: By
Last change:
Date: 8 years ago
Size: 4,882 bytes
 

Contents

Class file image Download
<html>
<title>Return JavaScript Validation Function.</title>
<?
    
require_once("ClsJSFormValidation.cls.php");
    
$Validity=new ClsJSFormValidation;
    
$FormName="all";
    
$ControlNames=array("txtName"            =>array("''"    =>"Please Enter Your Name."),
                        
"txtTelephone"        =>array("''"    =>"Please Enter Your Telephone NO."),
                        
"txtEMail"            =>array("EMail"    =>""),    //Message Not Required For EMail Field. Default Message Will Show.
                        
"txtPassword"        =>array("''"    =>"Please Enter Your Password."),
                        
"txtConfirmPassword"=>array("''"    =>"Please Enter Confirm Password."),
                        
"radNational"        =>array("1"        =>"Please Check The Nationality."),
                        
"selStartMonth"        =>array("'Select Month'"=>"Please Select Start Month."));
    
$ValidationFunctionName="CheckValidity";
    
$SameFields=array("txtPassword","txtConfirmPassword");
    
$ErrorMsgForSameFields="Password and Confirm Password Are not Same.";
    
$JsCodeForFormValidation=$Validity->ShowJSFormValidationCode($FormName,$ControlNames,$ValidationFunctionName,$SameFields,$ErrorMsgForSameFields);
    echo 
$JsCodeForFormValidation;
?>
<style type="text/css">
<!--
.style1 {color: #000000}
-->
</style>
<body>
<form action="" method="post">
  <table width="100%"  border="0" cellpadding="0" cellspacing="0" >
  <td colspan="3" ><table  border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" >
    <tr>
      <td colspan="3" ><img src="space.gif" width="1" height="5"></td>
    </tr>
    <tr>
      <td >&nbsp;Name</td>
      <td>&nbsp;</td>
      <td><input name="txtName" type="text" class="formfieldstyle" value="" size="55"></td>
    </tr>
    <tr>
      <td colspan="3"><img src="space.gif" width="1" height="5"></td>
    </tr>
    <tr>
      <td >&nbsp;Telephone</td>
      <td>&nbsp;</td>
      <td><input name="txtTelephone" type="text" class="formfieldstyle" onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;" value="" size="55"></td>
    </tr>
    <tr>
      <td colspan="3">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;E-Mail</td>
      <td>&nbsp;</td>
      <td><input name="txtEMail" type="text" class="formfieldstyle" value="" size="55"></td>
      </tr>
    <tr>
      <td colspan="3">&nbsp;</td>
    </tr>
    <tr>
      <td>Password</td>
      <td>&nbsp;</td>
      <td><input name="txtPassword" type="text" id="txtPassword"></td>
    </tr>
    <tr>
      <td colspan="3">&nbsp;</td>
    </tr>
    <tr>
      <td>Confirm Password </td>
      <td>&nbsp;</td>
      <td valign="top"><input name="txtConfirmPassword" type="text" id="txtConfirmPassword"></td>
    </tr>
  </table></td>
  </tr>
  <tr>
    <td colspan="3" >&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3" ><input name="radNational" type="radio" value="1">
      Bangladeshi</td>
  </tr>
  <tr>
    <td colspan="3"></td>
  </tr>
  <tr>
    <td colspan="3" ><table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:collapse">
        <tr>
          <td><table  border="0" cellpadding="0" cellspacing="0" class="wahid">
              <tr>
                <td colspan="3" ><img src="space.gif" width="1" height="8"></td>
              </tr>
              <tr>
                <td > &nbsp;Desired Start Month</td>
                <td width="10" align="center"><strong>:</strong></td>
                <td>
                  <select name="selStartMonth" class="formfieldstyle">
                    <option value="Select Month" selected>Select Month</option>
                    <option value="January" >January</option>
                    <option value="February">February</option>
                    <option value="March" >March</option>
                    <option value="April" >April</option>
                    <option value="May" >May</option>
                    <option value="June" >June</option>
                    <option value="July" >July</option>
                    <option value="Auguest" >Auguest</option>
                    <option value="September" >September</option>
                    <option value="October" >October</option>
                    <option value="November" >November</option>
                    <option value="December" >December</option>
                </select></td>
              </tr>
              <tr>
                <td colspan="3"><img src="space.gif" width="1" height="5"></td>
              </tr>
          </table></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="3">&nbsp;</td>
  </tr>
  <tr>
    <td width="31%" align="right"><input name="btnSubmit" type="submit" class="button" onClick="return CheckValidity();" value="  Submit  ">      </td>
    <td width="0%">&nbsp;</td>
    <td width="69%"><input name="btnReset" type="reset" class="button" value="  Reset  "></td>
  </tr>
  </table>
</form>
</body>
</html>