This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes help with validation/ 2 functions on submit. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "help with validation/ 2 functions on submit." Watch "help with validation/ 2 functions on submit." New topic
Author

help with validation/ 2 functions on submit.

Justin Greenwald
Greenhorn

Joined: Aug 27, 2010
Posts: 5
ok first off I'm a beginner and am flying blind so to speak. Google and looking at other coding is what got me this far. I need this to run the function CCnotes() on submit as well as validate the fields which i tried to do via the ValidateCC function. Oh yes i do also have spry validation in here. and seeing it does not work on submit with running the CCnotes() i am using it for an onblur "helper" so to speak.This is a credit card payment page. Any ideas and tips are appreciated. help!
Justin Greenwald
Greenhorn

Joined: Aug 27, 2010
Posts: 5
oh one small change. the submit button: onClick="return ValidateCC" has to be changed to onClick="return CCnotes" and then I don't know what to do with the validation. I am so lost. HELP!!
vijin das
Ranch Hand

Joined: Jun 07, 2010
Posts: 129

just call ValidateCC() as the first statement in CCnotes() function and call


or try this may also work
dont call ValidateCC() as the first statement in CCnotes() function and modify your code as


just remeber to avoid return keyword ...for the above piece of code
am not sure about the result !!! just give a try ...

VIJINDAS
Justin Greenwald
Greenhorn

Joined: Aug 27, 2010
Posts: 5
ok so the second option didnt work. still working on the first one. how exactly would you call the ValidateCC() in CCnotes(). like i said im very new to this and want to make sure im getting stuff right. My only other thought with this is do i try to set up the validation to work down form. Like if statement (field 1 validate) pass then (field 2 validate) pass then....ect. and if fail dont submit or something like that. ideas?
vijin das
Ranch Hand

Joined: Jun 07, 2010
Posts: 129

first thing when you are writing in any forums dont try write everything in single line it does make sense as well as
difficult to read also..!!! so take care from next time onwards when you are posting ...!!!
I have some questions to you
1) why you are posting everything to the same HTML page ???
2) why you are not doing a simple form validation in ValidateCC()
ok
below is a llink to simple js validation js simple validation
in that site you can find some more js functionalities .......
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: help with validation/ 2 functions on submit.
 
Similar Threads
Retrieve data from other server using JavaScript
JSP Page to know what it does
Question on jQuery ajax functionality & troubleshooting called bean in JSF page
jQuery tabs form validation is failing
spaces while populating using s:iterator