日期:2014-05-16 浏览次数:20706 次
<html> <head> <title>Form</title> <!-- 引入jQuery --> <script src="<?php echo base_url()?>style/jquery.js" type="text/javascript"></script> <!-- 引入jQuery formValidator --> <link type="text/css" rel="stylesheet" href="<?php echo base_url()?>style/form_valide/style/validator.css"></link> <script src="<?php echo base_url()?>style/form_valide/formValidator.js" type="text/javascript" charset="UTF-8"></script> <script src="<?php echo base_url()?>style/form_valide/formValidatorRegex.js" type="text/javascript" charset="UTF-8"></script> <!-- 引入jQuery Form Plugin --> <script type="text/javascript" src="<?php echo base_url()?>style/ajax_form/jquery.form.js"></script> <script type="text/javascript"> $(document).ready(function(){ //提供回调函数,提供提交返回结果的处理 var options = { success:function(data) { alert(data); }}; //初始化验证插件,如果提交出错,则弹出对话框,如果正确,则通过ajax提交表单请求。 $.formValidator.initConfig({ formid:"form1", onerror:function(msg){alert(msg)}, onsuccess:function(){$('#form1').ajaxSubmit(options); return false;} }); //表单验证 $("#test1").formValidator({ onshow:"请输入用户名,只有输入\"maodong\"才是对的", onfocus:"用户名至少6个字符,最多10个字符", oncorrect:"该用户名可以注册"}) .inputValidator({min:6,max:10,onerror:"你输入的用户名非法,请确认"}) .regexValidator({regexp:"username",datatype:"enum",onerror:"用户名格式不正确"}); }); </script> </head> <body> <form action="<?php echo site_url("welcome/post")?>" method="post" name="form1" id="form1"> <td align="right">用户名:</td> <td><input type="text" name="test1"id="test1" style="width:120px" value="maodong" /></td> <td><div id="test1Tip" style="width:250px"></div></td> <input type="submit" name="button" id="button" value="提交" /> </form> </body> </html>
var_dump($_POST);