How to invoke component method by using form
artscomponent.cfc
<cfcomponent displayname="ArtsCFC" hint="Art Discover">
<cffunction name="GetArts" access="remote" output="yes">
<cfargument name="ArtistID" type="numeric" required="yes">
<cfargument name="MaximumPrice" type="numeric" required="yes">
<cfquery name="ArtDetails" datasource="cfcodeexplorer">
Select ArtName, Description, Price
From ART Where ArtistID = #arguments.ArtistID# And Price <= #arguments.MaximumPrice#
</cfquery>
<cfdump var="#ArtDetails#">
</cffunction>
</cfcomponent>
invokecomponentform.cfm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>How to invoke component method by using form</title>
</head>
<body>
<h2 style="color:DarkBlue; font-style:italic">
How to invoke component method by using form
</h2>
<hr width="400" align="left" color="PowderBlue" />
<br />
<cfform name="ArtsForm" method="post" action="artscomponent.cfc?method=GetArts">
<table>
<tr>
<td>
Artists ID
</td>
<td>
<cfinput type="text" name="ArtistID" validate="integer" required="yes" message="Input a valid artist id">
</td>
</tr>
<tr>
<td>
Maximum Price
</td>
<td>
<cfinput type="text" name="MaximumPrice" validate="integer" required="yes" message="Input a valid price">
</td>
</tr>
<tr align="right">
<td colspan="2">
<cfinput type="submit" name="SubmitBtn" value="Get Arts">
</td>
</tr>
</table>
</cfform>
</body>
</html>