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!

Hiding Control on a form based on dropdown selectio

Status
Not open for further replies.

sirnose1

Programmer
Nov 1, 2005
133
US
I am trying to hide a textbox control. If the purchase method selected from the dropdown is Bank Card I want to hide the Purchase order textbox. Nothing I have tried seems to work. Is this possible?

Here is the code for the listbox

<cfselect name="PurchaseMethod" required="Yes" message="You must select a purchase method" size="2">
<option value="Bank Card" <cfif PurchMeth EQ "Bank Card">selected</cfif>>Bank Card</option>
<option value="Purchase Order" <cfif PurchMeth EQ "Purchase Order">selected</cfif>>Purchase Order</option>
</cfselect>

Here is the code for the textbox:

<!-- BEGIN TextBox PO Number -->
<td valign="top" align="center" width="21%"><cfif #PO_NUM# NEQ ""><cfoutput>#PO_NUM#</cfoutput><cfelse><cfoutput><cfinput size="35" name="rec_PO_NUM"></cfoutput></cfif></td>
<!-- End TextBox TextBox PO Number -->
 
Yes. The usual way is to call a function onChange(). Inside the function get the selected list value. Then change the text box's visibility based on what was selected.

Here is an example that toggles the visibility of an element. You might use it as a basis for your function




----------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top