SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    vi
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool jquery.fn.validate to work with from by form name NOT just FORM (specific)

    I would like to initate the jquery.validation as is but for a specific form by form name. I can't seem to understand what do change everything I tried it still does not validate or change for that form only***


    It is not validating this form only, it is ignoring it all together. PLEASE ADVISE....
    Code:
     
         jQuery.fn.validated = function(sendTransfer){
                jQuery("transferVerify").each(function(){
                  if (this.tagName == "transferVerify") {
                       jQuery(this).submit(function(){
    				 $(function(){
    						$("transferVerify").submit(function(){
    						  //ShowProgressAnimation();	
    						  if($('.ValidationErrors').is(':visible')){
    							//$('#button-2').attr('class', cursor);
    							$('.button-3').removeAttr('disabled');
    							$('.button-3').removeClass("disabled");							
    							$("div.button-2").addClass("disabled");
    							$('input[type="submit"]').addClass("disabled");
    							$('input[type="submit"]').attr('disabled','disabled');	
    			
    								return false; 
    							 } else {
        						$("#loading-div-background").css({ opacity: 0.8 });
    							$("#loading-div-background").show();
    							$("span.button-2").addClass("disabled");
    							$('input[type="submit"]').addClass("disabled");
    							$('input[type="submit"]').attr('disabled','disabled');				
    								return true;				
    							 }	
    						});
    					});
                        if (ValidationErrors[jQuery(this).attr("id")].length == 0) 
                            sendTransfer();
    					return false;
                    });
                }
            });
        };

  2. #2
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    vi
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got this in place

    Code:
    function SendTransferAction(){	
        alert('ia m transferrring');
    			 $(function(){
    						$("#transferVerify").submit(function(){
    						  //ShowProgressAnimation();
    				          //Add errors here
    						  if($('.ValidationErrors').is(':visible')){
    							//$('#button-2').attr('class', cursor);
    							$('.button-3').removeAttr('disabled');
    							$('.button-3').removeClass("disabled");							
    							$("div.button-2").addClass("disabled");
    							$('input[type="submit"]').addClass("disabled");
    							$('input[type="submit"]').attr('disabled','disabled');	
    			                alert('ia m here transferrring');						
    								return false; 
    							 } else {
        						$("#loading-div-background").css({ opacity: 0.8 });
    							$("#loading-div-background").show();
    							$("span.button-2").addClass("disabled");
    							$('input[type="submit"]').addClass("disabled");
    							$('input[type="submit"]').attr('disabled','disabled');
                                alert('done transferrring');							
    								return true;				
    							 }	
    						});
    					});
                        if (ValidationErrors[jQuery(this).attr("id")].length == 0) 
                            callback();
    					return false;
               
               }
    but need to added the validation expression for that field on form.

    jQuery("#response").validate({
    expression: "if (VAL) return true; else return false;",
    message: "Please enter correct Capthcha Code"
    });

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,862
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    forms don't have names (only fields inside of forms have names) - if you want to restrict processing to a specific form then reference the form by its id.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •