Home › Forums › CSS › Placeholders are being validated via jQuery Validation before user interaction
- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
-
AuthorPosts
-
November 20, 2013 at 2:08 pm #156720theogradParticipant
I have placeholders on my input fields that are being validated before the user even does anything.
http://rsatestamls.kaliocommerce.com/Register.aspx
Any ideas on fixing?
Thanks.
November 20, 2013 at 2:28 pm #156725AlenParticipantYou have the validate kick in on document.ready, shouldn’t you only call this when user submits the form by adding event handler to the submit button.
November 20, 2013 at 2:53 pm #156728theogradParticipantAt the expense of sounding clueless, how would I fire an event handler on the submit button?
November 20, 2013 at 3:04 pm #156729AlenParticipantSince you’re using jQuery take a look at
.submit()
http://api.jquery.com/submit/November 21, 2013 at 8:42 am #156802theogradParticipantTrying to use the .submit method on my checkout page real quick.
This is what I’ve got, but it doesn’t fire:
<script> $(document).ready(function(){ $("#Method input:checkbox").change(function() { if (this.checked) { var checkname = $(this).attr("name"); $('input[type=checkbox][id=OnAccount]').prop('value', 'True') $("input:checkbox[name='" + checkname + "']").not(this).removeAttr("checked"); } else { $('input[type=checkbox][id=OnAccount]').val('No'); } }); $("#CheckoutOptions input:checkbox").change(function() { if (this.checked) { var checkname = $(this).attr("name"); $("input:checkbox[name='" + checkname + "']").not(this).removeAttr("checked"); } }); }); $("#CheckOut").submit(function( event ) { alert( "Handler for .submit() called." ); jQuery.validator.setDefaults({ debug: false, success: "valid" }); $("#CheckOut").validate({ rules: { FirstName: { required: true }, LastName: { required: true }, Email: { required: true, email: true }, Phone: { required: true, digits:true }, Address1: { required: true }, City: { required: true }, PostalCode: { required: true, digits: true }, Country: { required: true }, State: { required: true }, pwd: { required: true }, pwd_confirm: { required: true }, FName_SHIP: { required: true }, LName_Ship: { required: true }, Phone_Ship: { required: true, digits: true }, Address1_Ship: { required: true }, City_Ship: { required: true }, PostalCode_SHIP: { required: true, digits: true }, COUNTRY_SHIP: { required: true }, State_SHIP: { required: true }, NameOnCard: { required:{ depends: function(element) { return $("#CCMethod").is(":checked"); } } }, CreditCardType: { required:{ depends: function(element) { return $("#CCMethod").is(":checked"); } } }, CardNumber: { required:{ depends: function(element) { return $("#CCMethod").is(":checked"); } } }, CardExpMonth: { required:{ depends: function(element) { return $("#CCMethod").is(":checked"); } } }, CardExpYear: { required:{ depends: function(element) { return $("#CCMethod").is(":checked"); } } }, CVC: { required:{ depends: function(element) { return $("#CCMethod").is(":checked"); } } }, customernumber: { required:{ depends: function(element) { return $("#OnAccount").is(":checked"); } } } } }); }); populateCartTotal(); </script>
-
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘CSS’ is closed to new topics and replies.