使用组件处理 ColdFusion 表单

Process ColdFusion Form with Component

当Coldfusion 表单调用cfc 作为动作时,浏览器是否可以停留在表单页面或组件功能是否必须将其重新路由回表单页面?

<cfform name="crops" action="cfc/stages.cfc?method=update" method="post">

上面的表单发布后,它会停留在组件页面上,而不是重新路由回表单页面。

完成您想要的事情的一种简单方法是将表单提交到包含它的页面。不需要 ajax。

<cfif StructKeyExists(form, "aKnownFormField")>
code to process form
can use create object to access cfc code if you want
</cfif>
<form action="thePageIAmOn.cfm" method="post">
<input name="aKnownFormField" type = "text">
more form fields
</form>