Solved

Jquery.validationengine custom validation

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now