Would help to see the code in question.
Normally, your <form> tag would call the JS validation in the onsubmit
method. Something like:
<form id="myForm" onsubmit="return validateFields( this );">
Then your JS would look something like:
function validateFields( oForm ) {
(validate stuff here)
if ( form did not pass validation ) {
return false;
}
}
The "return false" is key there. Since the onsubmit in the form tag is
going to return true or false, if the JS function returns false, the form
will not submit.
On Tue, Mar 23, 2010 at 3:25 PM, Jason Wilke <[email protected]> wrote:
>
> I'm using a CFMail page to submit info to a user, and I have a JS
> validation on it. When I submit a test that fails the validation, I get the
> appropriate JS alert messages, but the CFM page still calls the confirmation
> URL.
>
> How do I keep the focus on the original form/HTML page and prevent
> accessing the confirmation until the JS passes validation?
>
> Thanks,
> Jason (Newbie)
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/javascript/message.cfm/messageid:6299
Subscription: http://www.houseoffusion.com/groups/javascript/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/javascript/unsubscribe.cfm