0
validate: function () {
			contact.message = '';
			if (!$('#contact-container #contact-name').val()) {
				contact.message += 'Name required. ';
			}
			if (!$('#contact-container #contact-phone').val()) {
				contact.message += 'Phone required. ';
			}
			[B]if (!$('#contact-container #contact-phone').length()<>10) {
				contact.message += 'Phone no should be of 10 digit. ';
			}[/B]
			var email = $('#contact-container #contact-email').val();
			if (!email) {
				contact.message += 'Email required. ';
			}
			else {
				if (!contact.validateEmail(email)) {
					contact.message += 'Invalid email ';
				}
			}
             
            
			if (!$('#contact-container #contact-message').val()) {
				contact.message += 'Msg required.';
			}
			

			if (contact.message.length > 0) {
				return false;
			}
			else {
				return true;
			}
			
		},
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by stbuchok
0

What value is it giving you? Does it say undefined? Also, don't use double negatives.

if ($('#contact-container #contact-phone').length() === 10) {
	contact.message += 'Phone no should be of 10 digit. ';
}

//however I think you actually meant this
if ($('#contact-container #contact-phone').length() !== 10) {
	contact.message += 'Phone no should be of 10 digit. ';
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.