Solved

Jquery.validationengine custom validation

Posted on 2013-12-30
3
425 Views
Last Modified: 2014-01-17
I ma using Jquery.validationengine and it works just fine. However, I am trying to validate the email address which has to unique. The problem is I need to pass multiple parameters to the function but plugin does not allow passing inline parametrs.

So I thought that I can use regular ajax call and if it fails display the same balloon message.

The form variables are dynamic (that where the problem is)

 <input id="121" class="validate[maxSize[40]] text-input" type="text" name="121" value="">

<script>

	$(document).ready(function(){
		$('###rc.qry.ID#').keyup(url_check3);
	});
	
	function url_check3(){
		var name = $('###rc.qry.ID#').val();
		if(name.length) {	
			jQuery.ajax({
				type: "POST",
				url: "index.cfm?event=ehHan.check" + "&bodyData=" + name + "&ID=#rc.qry.ID#&type=#rc.qry.datatypeID#" ,
				dataType: "json",
				cache: false,
				success: function(response){
					if (response.recordcount  > 0) {
						$('###rc.qry.ID#').css('border', '3px ##C33 solid');
			
						$("###rc.qry.ID#formError").show();
						$('.error').remove();
						$('###rc.qryGetRegistrationFields.bodyDataDefinitionID#').after('<span class="error"></span>');
						$('.error').text('Please choose a different value because it was used by someone else');
						$('##submit1').attr("disabled", true);
						return false;
					}
					else {
						$('###rc.qry.ID#').css('border', '1px ##AAAAAA solid');
						$('.error').remove();
						$(".formError").hide();
						$('##submit1').attr("disabled", false);
						return true;
					}
				}
			});
		}
	}
	
</script>

Open in new window

0
Comment
Question by:erikTsomik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39748652
What about :

<span id="emailWrapper"><input id="121" class="validate[maxSize[40]] text-input" type="text" name="121" value=""></span>

and use :
$('##emailWrapper input').keyup(url_check3);
0
 
LVL 19

Author Comment

by:erikTsomik
ID: 39750056
BUt this will not trigger the balloon message?
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39750069
where to see the page ? Or could you set up a working demo on jsfiddle?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question