Processing actions using form posts

To process a form post, use the createActionURL() function, which generates the form action URL. 
For example:

<cfoutput>
<form action="#createActionURL()#" method="post">
Value: <input type="text" name="action_value" >
<input type="submit" value="Process Action" />
</form>
</cfoutput>
<cfoutput> <form action="#createActionURL()#" method="post"> Value: <input type="text" name="action_value" > <input type="submit" value="Process Action" /> </form> </cfoutput>
<cfoutput> 
<form action="#createActionURL()#" method="post"> 
Value: <input type="text" name="action_value" > 
<input type="submit" value="Process Action" /> 
</form> 
</cfoutput>

When the form is submitted, the portal container calls the processAction() method in your CFC. So, add this method as follows:

<cffunction name="processAction" returntype="void" access="public" output="false" hint="Called by the portlet container to allow the portlet to process an action request.">
<cfargument name="actionRequest" type="any" required="true" hint="A
javax.portlet.ActionRequest java object">
<cfargument name="actionResponse" type="any" required="true" hint="A
javax.portlet.ActionResponse java object">
<cfif IsDefined("request.portlet.parameters.action_value")>
<!--- do something with this value, such as update your database --->
</cfif>
</cffunction>
<cffunction name="processAction" returntype="void" access="public" output="false" hint="Called by the portlet container to allow the portlet to process an action request."> <cfargument name="actionRequest" type="any" required="true" hint="A javax.portlet.ActionRequest java object"> <cfargument name="actionResponse" type="any" required="true" hint="A javax.portlet.ActionResponse java object"> <cfif IsDefined("request.portlet.parameters.action_value")> <!--- do something with this value, such as update your database ---> </cfif> </cffunction>
<cffunction name="processAction" returntype="void" access="public" output="false" hint="Called by the portlet container to allow the portlet to process an action request."> 
<cfargument name="actionRequest" type="any" required="true" hint="A 
javax.portlet.ActionRequest java object"> 
<cfargument name="actionResponse" type="any" required="true" hint="A 
javax.portlet.ActionResponse java object"> 
<cfif IsDefined("request.portlet.parameters.action_value")> 
<!--- do something with this value, such as update your database ---> 
</cfif> 
</cffunction>

Get help faster and easier

New user?