Wednesday, June 8, 2011

validation sourse code





make sure write onclick function <form tag in method attr> instead on button submit onclick



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="validations_Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
        <title>JQuery Validation Engine</title>
        <link rel="stylesheet" href="../css/validationEngine.jquery.css" type="text/css"/>
        <link rel="stylesheet" href="../css/template.css" type="text/css"/>
        <script src="../js/jquery-1.6.min.js" type="text/javascript">
        </script>
        <script src="../js/languages/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8">
        </script>

        <script src="../js/jquery.validationEngine.js" type="text/javascript" charset="utf-8">
        </script>
        <script>
            jQuery(document).ready(function() {
                // binds form submission and fields to the validation engine
                jQuery("#formID").validationEngine();
            });

            function hello() {

                alert('hiiii');
            }
        </script>
    </head>
    <body>
   
        <div calss="viv">
        <form id="formID" class="formular" method="post" action="javascript:hello()">
       
       
          <fieldset>
                <legend>
                    Text field
                </legend>
                <label>
                    URL begin with http:// https:// or ftp://
                    <br/>
                    <span>Enter a URL : </span>
                    <input value="http://" class="validate[required,custom[url]] text-input" type="text" name="url" id="url" />

                </label>
            </fieldset>
           
           <table>
           <tr>
           <td>
           name
           </td>
           <td><input type="text" id="tdtxt" class="validate[required]"  /></td>
           </tr>
          
           <tr>
           <td>
            <select name="sport" id="sport" class="validate[required]">
                        <option value="">Choose a sport</option>
                        <option value="option1">Tennis</option>
                        <option value="option2">Football</option>
                        <option value="option3">Golf</option>
                    </select>
           </td>
           </tr>
           </table>
       
       
       
       
       
            <input class="submit" type="submit" value="Validate & Send the form!"/>
            <hr/>
        </form>
</div>
    </body>
</html>

No comments:

Post a Comment