मैंने इस बारे में कई अन्य पोस्ट पढ़ी हैं और अभी भी नहीं जाना है। इसे वास्तविक सरल रखने की कोशिश कर रहा है। मुझे अंतिम फॉर्म से पहले एक jQuery accordion में छुपा/दिखाया जा रहा है कि किसी भी रूप के अनुभागों को सत्यापित करने की आवश्यकता है। मैं लंबे समय तक jquery.validate.js
का उपयोग कर रहा हूं और जब तक मैं submit
पर मान्य हूं, तब तक सब अच्छा है, लेकिन अब जब मैं बटन click
पर सत्यापन करने का प्रयास करता हूं तो यह काम नहीं कर रहा है।को jquery.validate सबमिट किए बिना
<script type="text/javascript">
jQuery().ready(function(){
var demo = $(".demo").accordion({
header: '.header',
event: false
});
var nextButtons = $([]);
$("h3.header", demo).each(function(index) {
nextButtons = nextButtons.add($(this)
.next()
.children(":button")
.filter(".next, .previous")
.click(function() {
demo.accordion("activate", index + ($(this).is(".next") ? 1 : -1))
}));
});
});
</script>
<script type="text/javascript">
$(".next").click(function(){
$("#test").validate({
rules: {
name: "required", // simple rule, converted to {required:true}
email: {// compound rule
required: true,
email: true
},
comment: {
required: true
}
},
message: {
comment: "Please enter a comment."
}
});
});
</script>
<div class="demo">
<form action="#" method="post" id="test">
<fieldset>
<div id="accordion">
<h3 class="header"><a href="#">Section 1</a></h3>
<div class="sec1">
<label for="name">Name:</label>
<input type="text" id="name" placeholder="Enter your
full name" class="required" />
<input type="button" class="next" value="NEXT" />
</div>
<h3 class="header"><a href="#">Section 2</a></h3>
<div class="sec2">
<label for="email">Email:</label>
<input type="email" id="email" placeholder="Enter
your email address" class="required" />
<input type="button" class="next" value="NEXT" />
<input type="button" class="previous" value="Previous"/>
</div>
<h3 class="header"><a href="#">Section 3</a></h3>
<div class="sec3">
<label for="message">Message:</label>
<textarea id="message" placeholder="What's on your
mind?" class="required"></textarea>
<input type="submit" value="Send message" />
<input type="button" class="previous" value="Previous"/>
</div>
</fieldset>
</form>
</div>
</div><!-- End demo -->
यह [पोस्ट] (http://stackoverflow.com/questions/11703955/jquery- Valalidation-before-ajax-submit/11704059#11704059) आपकी मदद करेगा। –
आपके उत्तर के लिए धन्यवाद कुंदन। मुझे खेद है लेकिन मुझे नहीं लगता कि यह मेरी मदद कैसे करता है। मेरे पास मेरे फॉर्म टैग पर कोई भी सबमिट नहीं है और मैं '("#test") की जांच नहीं कर रहा हूं। कुछ होने के लिए सच होने के लिए मान्य करें। मैं प्रसंस्करण/मूल्यांकन के लिए मेरे फ़ील्ड के मानों को वैधकर्ता के कार्यों में पास करना चाहता हूं। ऐसा लगता है कि "अगली" कक्षा के साथ बटन से जुड़े क्लिक फ़ंक्शन बस नहीं हो रहा है –