javascript - submit data per post after validation jquery applied doesn't work ($_POST empty) -


i have problem jquery, ajax , field validation.

the validation works, redirect works if fine input,but values fields not contained in $_post array.

here form start tag:

<form class="smart-form" id="register-form" method="post" action="#pages/target.php" novalidatee>

here javascript part:

<script type="text/javascript">                       // load form valisation dependency  loadscript("js/plugin/jquery-form/jquery-form.min.js", runformvalidation);   // registration validation script function runformvalidation() {     //e.preventdefault();     var $checkoutform = $('#register-form').validate({      // rules form validation         rules : {             name : {                 required : true             },             vorname : {                 required : true             },               passwort : {                 required : true,                 minlength: 8             },             passwort2 : {                 required : true,                 minlength: 8             },             email : {                 required : true,                 email : true             },                       admin : {                 required : true,                 min: {                   // min needs parameter passed                   param: 1                 }             },         },          // messages form validation         messages : {                 /* messagees*/ not mentionend          },         // ajax form submition         success : function() {                      form.submit();                     $('#register-form').addclass('submited');                 },           // not change code below         errorplacement : function(error, element) {             error.insertafter(element.parent());         }     });         };  

reading through documentation validate method of plugin, found out should using submithandler callback when want submit valid form.

submithandler (default: native form submit):

callback handling actual submit when form valid. gets form argument. replaces default submit. right place submit form via ajax after validated.

and @sparky mentioned: you typically not need success option unless want utilize error label on valid element green checkmark or something.

success type: string or function()

if specified, error label displayed show valid element. if string given, added class label. if function given, called label (as jquery object) , validated input (as dom element). label can used add text "ok!".

so, instead of placing form.submit(); bit inside of success callback, should place inside of submithandler.

so code should this:

// optional, read success: 'valid',   // actual form submitting submithandler: function (form) {     form.submit(); }, 

by way, form.submit() not ajax, understand, submits form in traditional way.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -