Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form variable passing 1

Status
Not open for further replies.

wouter

Technical User
Jul 3, 2000
45
NL
Hello,

im embarrased for asking, but i just can't figure it out. It's beenalmost 2 years since i've done some cf-work.

This is the code of desktop.cfm:

*****start code*****

<cfif NOT IsDefined(&quot;form.param_status&quot;)>

<cfquery name=&quot;GetStatus&quot; datasource=&quot;Home&quot; dbtype=&quot;ODBC&quot;>
select * from dl_status
</cfquery>

<cfelseif form.param_status EQ 'off'>

<cfquery name=&quot;PutStatus&quot; datasource=&quot;Home&quot; dbtype=&quot;ODBC&quot;>
Update dl_status
set status = 'off'
where status_ID = 1
</cfquery>

<cfquery name=&quot;GetStatus&quot; datasource=&quot;Home&quot; dbtype=&quot;ODBC&quot;>
select * from dl_status
</cfquery>

<cfelseif form.param_status EQ 'on'>

<cfquery name=&quot;PutStatus&quot; datasource=&quot;Home&quot; dbtype=&quot;ODBC&quot;>
Update dl_status
set status = 'on'
where status_ID = 1
</cfquery>

<cfquery name=&quot;GetStatus&quot; datasource=&quot;Home&quot; dbtype=&quot;ODBC&quot;>
select * from dl_status
</cfquery>

</cfif>

<cfoutput query=&quot;GetStatus&quot;>
<cfif #status# EQ 'on'>
<cfset #value2# = 'off'>
<cfset #value1# = 'on'>
<cfelse>
<cfset #value2# = 'on'>
<cfset #value1# = 'off'>
</cfif>
</cfoutput>

<html>
<head>
<title>Admin</title>
</head>

<body>

<cfoutput query=&quot;GetStatus&quot;>
<cfif #status# EQ 'on'>
Download allowed
<cfelse>
Download not allowed
</cfif>
</cfoutput>

<form action=&quot;desktop.cfm&quot; method=&quot;post&quot;>

<select name=&quot;form_status&quot;>
<option value=&quot;<cfoutput>#value1#</cfoutput>&quot;>
<cfoutput>#value1#</cfoutput>
</option>
<option value=&quot;<cfoutput>#value2#</cfoutput>&quot;>
<cfoutput>#value2#</cfoutput>
</option>
</select>

<input type=&quot;Submit&quot; value=&quot;Toggle&quot; name=&quot;Submit_button&quot;>

</form>

</body>
</html>

*****end code*****

It's supposed to be able to switch the status from on to off and reverse. But i guess something goes wrong with passing the variable to the new instance of the page. I've tried stuff like: action=&quot;desktop.cfm?param_status=form.form_status&quot; but it doesn't work either. Tomorrow i'll receive my new cf5.0 reference book, but it's not tomorrow yet (sadly). Any help is greatly appreciated.

regards wouter Wouter
zure_zult@hotmail.com
To me, boxing is like a ballet, except there's no music, no choreography, and the dancers hit each other.
 
Well it seems you are checking:

form.param_status

but you aren't passing a form variable named &quot;param_status&quot;; instead you are passing a form variable named &quot;form_status&quot;.

-Tek
 
Thanks Tek,

that was most helpfull. I should have known that, but i just forgot everything. Thanks a bunch. Wouter
zure_zult@hotmail.com
To me, boxing is like a ballet, except there's no music, no choreography, and the dancers hit each other.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top