Cold Fusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Iron Speed
 
Go Back   Dev Articles Community ForumsProgrammingCold Fusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old June 4th, 2007, 04:10 PM
cfstudent cfstudent is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2007
Posts: 2 cfstudent User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 14 sec
Reputation Power: 0
Coldfusion javascript show hide text box based on dropdown selected. thanks

hello i wish to show/appear and dissappear text box based on a the drop down item selected.

what do i have to add to the code below.? div?


under Comm_DEV
drop down selection.

if CELL_Phone then CELL_Phone text box shows/appears
if pager_device then CELL_Phone text box dissappears.

if email_Address only is selected then pager_device and CELL_Phone dissappears otherwise JOB_email_Address is shown ( even if CELL_Phone or pager_device is selected JOB_email_Address still appears)

Thank you
n
thanks in Adv
<!---------------------------------------------->
the field Comm_DEV gets populated with "E","CE","PE" when it is submit
when selected from the drop down.
<table>
<tr>
<td>Comm_DEV </td>
<td>
<SELECT name="Comm_DEV" size="1">
<OPTION Value = "EM">Please Select</OPTION>
<OPTION Value = "CE" <cfif Comm_DEV is "CE">selected</cfif>>CELL_Phone</OPTION>
<OPTION Value = "EM" <cfif Comm_DEV is "EM">selected</cfif>>email_Address Only</OPTION>
<OPTION Value = "PE" <cfif Comm_DEV is "PE">selected</cfif>>pager_device</OPTION>
</select> <!--------------------------></td>
</tr>
<!------Here are the text boxes to appear or dissapear CELL_Phone and JOB_email_Address-------------------->
<tr>
<td>CELL_Phone</td>
<td><cfoutput>
<cfif NOT len(trim(device_email_Address))><cfset device_email_Address = "@cingularme.com"></cfif>
<input type="Text" name="Device_email_Address" value="#Device_email_Address#" size="40" maxlength="40"> </td>




<td>
<b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">JOBemail_Address</font></b><br>
<cfif not len(trim(JOB_email_Address))><cfset JOB_email_Address = "@balbal.org"></cfif>
<input type="text" name="JOB_email_Address" Value="#JOB_email_Address#" size="40"><br><br>
</cfoutput></td>
</tr>


</table>

Reply With Quote
  #2  
Old June 28th, 2007, 12:13 AM
errodr errodr is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 7 errodr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 17 sec
Reputation Power: 0
Input Toggle

Two different ways to toggle inputs (not fully tested), just ideas. I would recommend using "display" instead of "visibility" to hide/show inputs.

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>

<script language="javascript">
	function switchInputs(){
		sVal = document.f1.Comm_DEV.options[document.f1.Comm_DEV.selectedIndex].value; 

		eArr = document.getElementsByTagName('tr');
		for(var x = 0; x < eArr.length; x++){
			idVal = eArr[x].id.split("-");

			if(idVal[0] == 'toggle'){
				if(idVal[1] == sVal){
					eval("document.getElementById('toggle-" + sVal + "').style.visibility='visible'");
				} else {
					eArr[x].style.visibility = 'hidden';
				}
			}
		}		
	}

	function morph(){
		sVal = document.f1.Comm_DEV.options[document.f1.Comm_DEV.selectedIndex].value;

		if(sVal == 'CE'){
			document.getElementById('morph-input').innerHTML='<input type="text" name="cell_phone">';
			document.getElementById('morph-td').innerHTML='Cell Phone:';
			document.getElementById('morph-tr').style.visibility='visible';
		} else if(sVal == 'PE'){
			document.getElementById('morph-input').innerHTML='<input type="text" name="pager_device">';
			document.getElementById('morph-td').innerHTML='Pager Device:';
			document.getElementById('morph-tr').style.visibility='visible';
		} else if(sVal == 'EM'){
			document.getElementById('morph-input').innerHTML='<input type="text" name="email_address">';
			document.getElementById('morph-td').innerHTML='Email Address:';
			document.getElementById('morph-tr').style.visibility='visible';
		}
	}
</script>
</HEAD>

<BODY>
<form name="f1">
<table>
<tr>
<td>Comm_DEV </td>
<td>
<SELECT name="Comm_DEV" size="1" onChange="morph();">
<OPTION Value="">Please Select</OPTION>
<OPTION Value="CE">CELL_Phone</OPTION>
<OPTION Value="EM">email_Address Only</OPTION>
<OPTION Value="PE">pager_device</OPTION>
</select></td>
</tr>
<tr id="toggle-CE" style="visibility:hidden;">
	<td>Cell Phone:</td>
	<td><input type="text" name="cell_phone"></td>
</tr>
<tr id="toggle-EM" style="visibility:hidden;">
	<td>Email Address:</td>
	<td><input type="text" name="email_address"></td>
</tr>
<tr id="morph-tr" style="visibility:hidden;">
	<td id="morph-td"></td>
	<td id="morph-input"></td>
</tr>
</table>
</form>
</BODY>
</HTML>

Reply With Quote
  #3  
Old March 31st, 2008, 03:30 AM
crishna crishna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 1 crishna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 3 sec
Reputation Power: 0
coldfusion application development

cf.etisnew

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingCold Fusion Development > Coldfusion javascript show hide text box based on dropdown selected. thanks


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway