Regardless validate validation summary

When using validate verification found that some input validation does not work,

such as:

readonly,disabled,:reset(type= reset),:submit,:image,hidden, display:none

When the tag has these properties, the validate default does not verify, the business logic for the fit, the following method may be used:

First specified tag before submitting to property can not be verified as the attributes removed,

if($("#photoCover").attr("readonly")=="readonly"){
			$("#photoCover").removeAttr("readonly");//提交前,去除只读属性
		}

And then submit

the trigger validate, when re-submitted, input readonly attribute has been no verification, in order to prevent conflicts with the business logic,
 

When the page loads, give specified label binding cursor focusing method,

$("#photoCover").focusin(function(){//光标聚焦
			$(this).prop('readonly', true);
		}); 

or

$("#photoCover").mouseover(function(){//鼠标悬浮
			$(this).prop('readonly', true);
		}); 

If it is above the problem, check the submission method,

for example, you enter an input, then leave the cursor will be verified, but the author is not verified; or is it, what are good, but I could not verify, do not worry!

Detection submission, whether submitted through a form submit method form, and if so, submit button is replaced,

E.g: 

<form action="saveuser.do" id="mainForm">

    <input type="text" name="username">
    <input type="password" name="password">    

<form>

<script>
    $("#mainForm").submit();
</script>

Replaced by: 

<input id="savebtn" type="submit" value="提交">

<script>
    $("#savebtn").click();
</script>

Success ~

 


Regardless of when the other:

There is no checking interceptor intercepting jquery.validate.js (path has not blocked)

Check the form form form form id id and whether the same method js

Guess you like

Origin blog.csdn.net/qq_41340666/article/details/80982105