admin管理员组文章数量:1403364
I am submitting a ColdFusion Form and I want to run some JavaScript to check field validation before I run my ColdFusion code to process the form as needed.
How can I do this? What do I do in JS to call my .cfm file after the form passes validation?
Thanks!
-Jason
I am submitting a ColdFusion Form and I want to run some JavaScript to check field validation before I run my ColdFusion code to process the form as needed.
How can I do this? What do I do in JS to call my .cfm file after the form passes validation?
Thanks!
-Jason
Share Improve this question asked Feb 2, 2009 at 16:56 Jason SlackJason Slack4 Answers
Reset to default 6You need
<form name="myform" action="myserverscript.cfm" onsubmit="return validate()">
if you return true the form submits, false it doesn't
i hope you're doing the validation on the server side as well. never rely on just javascript to scrub your data.
JQuery - http://jquery./ validation addin for jquery - http://docs.jquery./Plugins/Validation
very simple to do tons of example on jquery.
You can attach a onclick
event to your input button, for example:
<input type="submit" value="Submit" onClick="validate()">
Then the validate method will be responsible for checking form values. The validate method should return true
if the form is valid, thus mitting
the form submit. If it returns false
the form is not submitted. This is how it works for HTML, JavaScript and forms.
In addition, the docs linked by mark should help you further.
本文标签: coldfusionJavaScript on Form SubmitStack Overflow
版权声明:本文标题:coldfusion - JavaScript on Form Submit - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744377110a2603313.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论