JQuery :: Postcode Validation Through Validator?
Jan 9, 2011
My client is using the following script to validate a form : -
[URL]
I want to be able to validate a Postcode by matching a regular expression (using this script). There is no default option with this jQuery script to do so. My question is can I add such a custom regex to this script?
I have only ever written validation in "normal" JS before. Also I would like the JS regex to match the existing one serverside (PHP):
[code]....
View 11 Replies
ADVERTISEMENT
Feb 9, 2009
You're going to look at this code and see straight away what's wrong with it, but I've been staring at it for too long that my brain just isn't reading it right.
It's a basic input, you type in your postcode, if it is in the list of postcodes I entered then it replies with a 'Yes' response, otherwise a 'No' response. Unfortunately it keeps saying 'Yes' to anything that's entered.
Here it is, and apologies again for it being annoyingly simple, you know when you've been looking at code too much and you just can't see the small things anymore. [input type.needed=coffee]
View 4 Replies
View Related
Sep 25, 2010
Basically I'm looking for a method where the user enters their postcode (UK only) clicks enter then they're displayed with their closest region (although not every single UK region will be displayed, only 6 of them). I know this is a fairly tricky one.I've had a look in to Google API though there's nothing really specific for this, does anyone have an idea? or point me in the right direction to achieve this?
View 1 Replies
View Related
Feb 14, 2011
I would like to set the postcode <?php echo $pubdetails['rsPostCode]; ?> as a default value in the form field so that the map area loads up automatically for instance the link above uses postcode bn11 3rg
View 5 Replies
View Related
May 3, 2011
I have searched everywhere and seems unable to find postcode map data (preferably in lat/long) of Canada. I would need these data up to the LDU in the postcode. My idea is to create a map with the postcode overlay similar to this:[URL]...Are there any third party data source which I can find of?
View 1 Replies
View Related
Jun 5, 2009
I'm quite new to Jquery, so I need some sort of advice. I'm working on a webbased application with a webservice. First it was a simple html site, but later I started using Jquery. Data is inserted in some forms, this I can easily validate through the validator. Now after all the data is ok, it's send to the webservice through the C#-code. Some calculations are being made with the data and a dataset is returned. Now some errors can occur while doing the calculations. I can't get some manual error in the errorbox of the validator. Is it possible to let the validator run some c#-function so I can see if the data is correct? Or can I set a unvisible checkbox to true/false through the c#-code so the validator check this box? A problem with both is, that the validator runs when I click on the "Next"-button. After the validaton, the function starts, so if I set the checkbox to false, the validator won't even notice. Anyone knows a handy approach for this?
[Code]...
View 3 Replies
View Related
Aug 8, 2011
Here is the line of code:
Which produces: {0}.00 instead of $0.00
Why is that happening? how can i fix it?
I'm including the jquery.validate.min.js file, fyi...
jQuery Validation Plugin 1.8.1
View 1 Replies
View Related
Jul 27, 2011
I've seen tons of things for fixing it with IE6 but some of my users are getting this with IE8.I don't see too many answers to problems with this plugin is it not being supported anymore?I also see that the version on the jQuery site is 1.5.5 and the version on the author's site is 1.8.1; does this mean that the author isn't keeping things here updated and thus isn't supporting the product via these channels like he says on his site?
View 3 Replies
View Related
May 21, 2011
how to specify the event in the rule?For example I create a rulejQuery.validator.addMethod("greaterThanZero", function(value, element) { return his.optional(element) || (parseFloat(value) > 0); }, "* Amount must be greater than zero");Iattach this rule to the form$('form').validate({ rules : { amount : { greaterThanZero : true } } });how can I specify when this rule should be checked , for example onChange oronKeypress or when another field is edited. Is it possible to do this as a form validate rule?
View 1 Replies
View Related
May 13, 2011
i'm trying to add a server side method to the jquery validator. my code is:
$.validator.addMethod("existing
",function (value){
$.ajax({url:"ajax.php",data: value,type:"POST"
,async: false, dataType: "text" }).responseText ==
[Code].....
View 2 Replies
View Related
Oct 15, 2010
Could anyone please explain why my validation doesn't work? When I use only predefined validation methods everything seems to be fine, but when I use a custom method it doesn't do anything until I click submit and then cancels the submit with "$.validator.methods[method] is undefined". The debugger does never jump into the "noBefore" method, I got a breakpoint at the first line. I've tried to write the "notBefore" in quotes in the rules but that doesn't seem to help either.Everything seems to be right, though.
[Code]...
View 5 Replies
View Related
May 11, 2009
I am validating my form fields using jquery validate plugin. but itsnot executing my methods. its hitting my validate() method but notactual validation code.I am pasting my code here for your reference.My javascript code:
mysite.validateFormFields = function() {
alert('here'); [color=green] [b]// its hitting here
[/b][/color]
[code]....
View 3 Replies
View Related
Feb 16, 2011
I have this php page that we load in an iFrame, calls a js file with validator working on it, worked fine forever, still works fine.I made a copy of this page for another iFrame, same js files, same fields, almost identical basically accept that the labels and fields are now arranged in a table instead of paragraphs for a different look and feel. On this page though, when I do something that calls invalidHandler (like leave out a required field) I do get the error, but the page still submits! I have tried everything, and its driving me nuts. When I use the console in the browser (by hitting the submit button and then quickly hitting the stop button) it shows that invalidHandler ran, found 1 invalid field, then submitHandler ran!
[Code]...
View 1 Replies
View Related
Nov 2, 2010
I am working with customised form validator..I've this html structure
<div id="tab-perfil"><fieldset>
<legend>Dados Pessoais</legend>
<div class="columns">
<div class="colx3-left-double required">
<label for="nome">Nome</label>
<span class="relative">
<input type="text" name="nome" id="nome" value="" class="full-width">
</span></div>
What I want to do is after the input add a span, I know how to do that, just use insertAfter('#nome'); but I have a class for the ERROR and a class for the OK. This is what I have so far
this.find("#formulario_criar-cliente").submit(function(){
var $inputs = $('#formulario_criar-cliente div .required :input');
$inputs.each(function() {
if ($(this).val() == "") {
$(this).addClass("error");
} else {
$(this).removeClass("error");
}});
return false;
});
When I add the class error I want to show a span with a class="check-error" and when I remove the class I want to show a span with a class="check-ok" but remove the error one. This is for multiple inputs... and I don't know how to achieve that =x
View 6 Replies
View Related
Jul 12, 2010
I wrote this function to be a change event applied to a checkbox. Now it is apparent I need to use it as a custom validator method, so it runs when you hit "Next" to step through the form. I have all that working, I just can't get the syntax of the rule right.
Here it is as a change event:
$(
'#MKDPT'
).change(
function(){
if(
$(
'#MKDPT'
).is(
':checked'
)){
var
checked
=
false
; .....
And my attempt at a custom validation rule:
$
.
validator
.
addMethod (
"MKDPTOnly" ,
function (
value .....
I have tried several versions, but none is letting the form go to the next step (return true) if the conditions are met.
View 7 Replies
View Related
Feb 15, 2011
We're trying to make all the HTML we write to be forward compatible so we're running our code through an HTML validator.The problem I'm seeing is that the 'rel' attribute is not valid for the <input> element. Although it works fine, is there a work-a-round for this?I've used the 'rel' attribute extensively since I've started using jQuery.
View 5 Replies
View Related
Aug 10, 2009
I know the refresh() method is gone since version 1.2 but for somereason even if it's suposed to work without it I can't get it to work.Here's the scenario:I got a select box, depending on the selection I want certain elementto validate so I dynamically add validation class to those elementlike this.$("input#element").toggleClass("{validate:{required:true}}");But when I click submit the element doesn't get validated at all but Ican see the class has been added in firebug.
View 2 Replies
View Related
Jul 5, 2010
I have created a couple simple custom validators but this one isn't working. I have an input #eSig and two others #FirstName and #LastName. I need to add a rule that says the value of #FirstName must be contained in eSig, and one that is the same for #LastName.
[Code]...
View 17 Replies
View Related
May 15, 2006
I am looking for HTML validator with the following restrictions:
1. Web server is the localhost (page should be validated locally).
2. The page is dynamic (generated by PHP with client side javascript,
which alters the DOM).
I tried the following:
1. Tidy Firefox extenstion (http://users.skynet.be/mgueury/mozilla/).
Unfortunately, it doesn't really makes the real DOM validation. In my
JS code, I had .inerHTML code injection, but this extension didn't show
the injected html code.
2. I am using FireBug Firefox extenstion. This extenstion shows the
real DOM, but unfortunately it doesn't validate the HTML.
3. MS developper toolbar for IE and Web Developper Firefox extenstion
make only external HTML validation.
View 12 Replies
View Related
Jul 30, 2003
Email Validator JavaScript (with and without RegExps):
<script language="JavaScript">
//////////////////////////////////////////////////
//<Email Validator>//
// by Premshree Pillai//
//http://www.qiksearch.com//
//http://premshree.resource-locator.com//
//////////////////////////////////////////////////
/* Without RegExps */
function isEmail(who) {
function isEmpty(who) {
var testArr=who.split("");
if(testArr.length==0)
return true;
var toggle=0;
for(var i=0; i<testArr.length; i++) {
if(testArr[i]==" ") {
toggle=1;
break;
}
}
if(toggle)
return true;
return false;
}
function isValid(who) {
var invalidChars=new Array("~","!","@","#","$","%","^","&","*","(",")","+","=","[","]",":",";",",",""","'","|","{","}","","/","<",">","?");
var testArr=who.split("");
for(var i=0; i<testArr.length; i++) {
for(var j=0; j<invalidChars.length; j++) {
if(testArr[i]==invalidChars[j]) {
return false;
}
}
}
return true;
}
function isfl(who) {
var invalidChars=new Array("-","_",".");
var testArr=who.split("");
which=0;
for(var i=0; i<2; i++) {
for(var j=0; j<invalidChars.length; j++) {
if(testArr[which]==invalidChars[j]) {
return false;
}
}
which=testArr.length-1;
}
return true;
}
function isDomain(who) {
var invalidChars=new Array("-","_",".");
var testArr=who.split("");
if(testArr.length<2||testArr.length>4) {
return false;
}
for(var i=0; i<testArr.length; i++) {
for(var j=0; j<invalidChars.length; j++) {
if(testArr[i]==invalidChars[j]) {
return false;
}
}
}
return true;
}
var testArr=who.split("@");
if(testArr.length<=1||testArr.length>2) {
return false;
}
else {
if(isValid(testArr[0])&&isfl(testArr[0])&&isValid(testArr[1])) {
if(!isEmpty(testArr[testArr.length-1])&&!isEmpty(testArr[0])) {
var testArr2=testArr[testArr.length-1].split(".");
if(testArr2.length>=2) {
var toggle=1;
for(var i=0; i<testArr2.length; i++) {
if(isEmpty(testArr2[i])||!isfl(testArr2[i])) {
toggle=0;
break;
}
}
if(toggle&&isDomain(testArr2[testArr2.length-1]))
return true;
return false;
}
return false;
}
}
}
}
/* With RegExp */
function isEmail2(who) {
var email=/^[A-Za-z0-9]+([_.-][A-Za-z0-9]+)*@[A-Za-z0-9]+([_.-][A-Za-z0-9]+)*.([A-Za-z]){2,4}$/i;
return(email.test(who));
}
</script>
View 9 Replies
View Related
Aug 7, 2002
Everyone around here sure seems to be doing lots of form validation. Fortunately, I have your solution. I've made a form validator that does LOTS AND LOTS of neat stuff. It's still 'beta' because I'm not done with x-browser 100% etc. Well, you can get all the dope here ....
View 2 Replies
View Related
Oct 6, 2011
Trying to make a simple validator for a form i've just created, but for some reason i cant get it to redirect to the pages upon the IF statements being fulfilled.I've got a feeling its because the form seems to still submit the selection...
[Code]...
View 1 Replies
View Related
Jan 26, 2005
I have some problems in validating my XHTML Transitional page with W3C validator. The problems are with this JS code:
Code:
<script language="javascript1.1" src="http://...."></script>
<noscript>
<a href="http://...." title=""><img src="http://...." width="468" height="60" alt="" /></a>
</noscript>
Is there a way to validate this code???
View 10 Replies
View Related
Mar 29, 2006
Using function FrontPage_Form1_Validator(theForm)
and added a function to trap a radio optin like
if (theForm.opt_in.value != "yes" || theForm.opt_in.value != "no")
{
alert("Please make a choice for the "opt_in" field.");
theForm.opt_in.focus();
return (false);
}
This traps if neither radio has been clicked BUT when I click on OK in the error message box it continues on without having click on a radio button?
Is the action of clicking the OK in the error message setting to True or something? Any idea of a fix?
View 1 Replies
View Related
Jun 14, 2007
Is there any function in JavaScript which validates the date format like isNaN() for numbers? Or have anyone made such function which validates the date entered in the text box i.e. dd-mm-yyyy or yyyy-mm-dd or mm-dd-yyyy or dd/mm/yyy or mm/dd/yyyy or yyyy/mm/dd are only the valid dates??
View 1 Replies
View Related
Oct 2, 2009
I have a form with multiple fieldsets which are visible conditionally. There are three submit buttons "Abandon", "Save" and "Save & Continue". Each button should validate specific controls of the form and submit it. I tried setting "onsubmit: false" and checking for "$('#myForm').valid ()" on click of these buttons., but that validates all controls of the form.
View 1 Replies
View Related