Page 1 of 1

Input field validation

Posted: Thu Mar 29, 2012 1:31 pm
by umesh.balasu

I want to be able to use the jQuery validation plugin to validate form fields. Looking through the jQuery validation plugin documentation it requires form tags and special attributes added to the input fields. Has anyone been able to successfully use the validation plugin? If not what are my other validation options. I want to be able to validate my input fields before invoking a service.


Input field validation

Posted: Thu Mar 29, 2012 5:38 pm
by maxkatz

There are a number blog posts, articles on jQuery Mobile validation: https://www.google.com/#hl=en&sclient...

I haven't tried them. You can also just get the value of a field with JavaScript and validate its value before invoking a service. You could show the message in an alert window or update a label and show the error message next to the field. Hope this helps.


Input field validation

Posted: Sat Nov 23, 2013 10:10 pm
by Louis Adekoya

Could you please give a quick example of "You can also just get the value of a field with JavaScript and validate its value before invoking a service. "

I have tried the following but it doesn't seem to work - not sure why. I'm new to JS and coding in general, but I have based the following on some examples I've seen.

var vFirstname = Appery(“txtFirstnameReg”).val();

if (vFirstname==null || vFirstname=="")

{

alert("First name must be filled out");

}


Input field validation

Posted: Sat Nov 23, 2013 10:27 pm
by Igor

Hello,

It looks like there is some problem with quotes Appery(“txtFirstnameReg”). Please try to replace quotes with next one "".


Input field validation

Posted: Sat Nov 23, 2013 10:27 pm
by maxkatz

You should check the value that you get in the first line and then see if the if-statement is ever true.


Input field validation

Posted: Sat Nov 23, 2013 10:55 pm
by Louis Adekoya

Thanks both.

Igor, my untrained eye can't see anything wrong with the quotes but you were right. I copied the quotes instead of typing them and it worked. Can I ask what exactly is wrong with the quotes I originally used? Just so I know for next time. Thanks.


Input field validation

Posted: Mon Nov 25, 2013 4:49 pm
by Maryna Brodina

Hello! There were quotes with a wrong format. You had this one “ ”, but it should be " " .


Input field validation

Posted: Mon Nov 25, 2013 10:48 pm
by Louis Adekoya

Thank you Maryna, I finally figured it out once I put on my glasses :-)