Answered
forms and parameters
Hi all,
I am trying to pass variables from a form to a .cfc with no success.
here's a simplified version of what I have (which is basically a compilation of adobe tutorial and documentation I've found):
***the initial .cfm***
input.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>
<title>addUser</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<!---First form: This form submits the end-user's search criteria--->
<form name="form1" action="update.cfm" method="post">
Test adding users: </br>
Enter a:
<p>clientid
<input type="text" name="clientid"/>
</p>
<p>user name
<input type="text" name="username"/>
</p>
<p>password
<input type="text" name="password"/>
<p>
<input type="submit" name="Submit"/>
</p>
</form>
</body>
</html>
***the called .cfm***
update.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>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<cfinvoke
component="dostuff"
method="addUser"
client= "#form1.clientid#"
uid= "#form1.username#"
pass= "#form1.password#">
</cfinvoke>
</body>
</html>
***the invoked function in this .cfc***
dostuff.cfc
*******************************************************************************************
<cfcomponent name="dostuff" output="false">
<cffunction name="addUser" access="remote" returnType="Struct">
<cfargument name="clientid" type="string" required="true"/>
<cfargument name="username" type="string" required="true"/>
<cfargument name="password" type="string" required="true"/>
... then i do "stuff" with these arguments here...
so, I consistently can't pass the arguments to my .cfc regardless of what the documentation says or what I try.
error thrown are usually something like... "Element USERNAME is undefined in FORM1"
any ideas out there?
I am trying to pass variables from a form to a .cfc with no success.
here's a simplified version of what I have (which is basically a compilation of adobe tutorial and documentation I've found):
***the initial .cfm***
input.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>
<title>addUser</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<!---First form: This form submits the end-user's search criteria--->
<form name="form1" action="update.cfm" method="post">
Test adding users: </br>
Enter a:
<p>clientid
<input type="text" name="clientid"/>
</p>
<p>user name
<input type="text" name="username"/>
</p>
<p>password
<input type="text" name="password"/>
<p>
<input type="submit" name="Submit"/>
</p>
</form>
</body>
</html>
***the called .cfm***
update.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>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<cfinvoke
component="dostuff"
method="addUser"
client= "#form1.clientid#"
uid= "#form1.username#"
pass= "#form1.password#">
</cfinvoke>
</body>
</html>
***the invoked function in this .cfc***
dostuff.cfc
*******************************************************************************************
<cfcomponent name="dostuff" output="false">
<cffunction name="addUser" access="remote" returnType="Struct">
<cfargument name="clientid" type="string" required="true"/>
<cfargument name="username" type="string" required="true"/>
<cfargument name="password" type="string" required="true"/>
... then i do "stuff" with these arguments here...
so, I consistently can't pass the arguments to my .cfc regardless of what the documentation says or what I try.
error thrown are usually something like... "Element USERNAME is undefined in FORM1"
any ideas out there?