Solved

Jquery.validationengine custom validation

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Where is java script information saved? 2 50
where is team.js? 3 23
How to create a textarea which saves text in HTML 8 35
Index on a Table 6 9
This article discusses how to create an extensible mechanism for linked drop downs.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

776 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