Skip to main content
Inspiring
June 21, 2011
Question

reset value to empty from drop box

  • June 21, 2011
  • 1 reply
  • 409 views

I have two drop boxes.  i want to display the value from each drop box when it is selected. The code i have dosen't work because somehow the value from drop1 is not rest to empty and always neq "".  I want it to be able to reset to "" when i selected drop2 and vice versa for drop1.

<cfparam name="drop1" default="">
<cfparam name="drop2" default="">

<cfform name="drop" id="drop" method="post">
<cfselect name="drop1" id="drop1"

<option value="">Select Name</option>
<cfloop query="variables.q1">
  <option value="#name#"
  <cfif drop1 eq name>selected</cfif>>#name#</option>
</cfloop>
</cfselect>

<br><br>

<cfselect name="drop2" id="drop2" >

<option value="">Select Org</option>
<cfloop query="variables.q2">
  <option value="#org#"
  <cfif drop2 eq org>selected</cfif>>#org#</option>
</cfloop>
</cfselect>

<br><br>
<input type="submit" name="submit" value="submit">
</cfform>
</cfoutput>


<cfif structKeyExists(form, "submit")>
<cfif drop1 neq "">
  <cfinclude template="test1.cfm">
<!--- <cflocation url="test1.cfm?drop1=#drop1#"> --->

<cfelseif drop2 neq "">
  <cfinclude template="test2.cfm">
   <!--- <cflocation url="test2.cfm?drop2=#drop2#"> --->
</cfif>
</cfif>

This topic has been closed for replies.

1 reply

Inspiring
June 21, 2011

To do what you appear to be attempting, you have to use javascript.