Solved

Jquery.validationengine custom validation

Posted on 2013-12-30
3
429 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

734 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