473,626 Members | 3,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to hide/show a text box using drop downlist in php

1 New Member
how to hide/show a text box using drop downlist in php
Feb 29 '08 #1
2 2993
hsriat
1,654 Recognized Expert Top Contributor
how to hide/show a text box using drop downlist in php
Please give some details?
Feb 29 '08 #2
nathj
938 Recognized Expert Contributor
how to hide/show a text box using drop downlist in php
Hi,

Define the list box with an onchange event handler that calls the function below. Next to the list box have the text box with the style set to display:none and with a unique ID.

The onchange then calls this JavaScript function:
Expand|Select|Wrap|Line Numbers
  1. function toggleDisplayState(poObjectToDisplay)
  2. {                                                         
  3.  
  4.     var loObject = document.getElementById(poObjectToDisplay);
  5.  
  6.     //test the current state of the object and toggle opposite state.
  7.     if (loObject.style.display != '' && loObject.style.display != 'none') 
  8.     {
  9.         loObject.style.display = 'none';
  10.       }
  11.     else 
  12.     {
  13.         loObject.style.display = 'inline';
  14.       } 
  15. }
  16.  
  17.  
This will toggle the display stae of the object ID you pass in. If you only want to change the ste depending no the value of th list box then you need to adjust the IF accordingly. this sghould be a enough of a basic premise for you.

Cheers
nathj
Feb 29 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
148577
by: Steve Speirs | last post by:
Hi I'm trying to show/hide a simple piece of text and a text field on a form based on what choice is made from a drop down box. <select name="dropdown" size="1"> <option selected value="">Please make a selection</option> <option value="1">Choice 1</option> <option value="2">Choice 2</option> <option value="3">Choice 3</option>
10
3201
by: David | last post by:
Hi everyone, Hoping there are some .js/browser experts out there that can help with this weird problem. I have made a swap div routine and applied the events to menu buttons with a closer layer behind the menus. The closer div has a lower index than the submenu divs so it appears behind them. The closer div contains a transparent gif with an event applied to it to close all of the divs when moused over.
19
6871
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the JavaScript in this code from a couple different sites but I'm not 100% sure what each line is doing...This is the ASP code that I'm using for the page....Take a look at the JavaScript code and please let me know what each line is doing....I have been...
2
1507
by: Tom Gao | last post by:
hi guys I'm wondering how do I pass a key-value pair to a drop downlist ? since I can not use hashtable as there is nor order.. and I can not use sortedlist as the order which I supply to the dropdownlist may not be sorted. how can I do this ? Thanks
7
1666
by: Markus McGee | last post by:
Hi all, I have a quick question...I believe. On my web page, call it page A, I have a drop downlist with runat server enabled. When the drop downlist change event occurs it repopulates a table depending on the value selected on page A. After I redirect page A to some other page, call it page B, and use the IE Back button to change my selection on the page A the page is forwarded to page B without rebuilding the table on page A and...
2
3249
Chittaranjan
by: Chittaranjan | last post by:
Hi All, I am having a problem using Javascript in Perl script. In the perl module I have included the Javascript codes and that is workign fine for validation purpose but when I am trying to show and hide some divisions randomly selecting from a drop down menu then that is working fine in Mozilla but not working in IE 6/7. Here is some part of my code: if any suggestions please welcome... Thanks, Chittaranjan This is the Javascript...
1
4164
by: pamate | last post by:
hi, I want to show hide layers. I am able to show and hide layers but i am facing problem that, cant view the cursor in Mozilla,but i can type in input text box, its overlapping the layers. I don`t want to change the way i have used to show and hide layers. check down code :- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
1
4538
by: TechnoAtif | last post by:
HI.. I am looking for php code that will enable me to hide/show a text box based on the users previous drop down list response. If javascript comes into use for it, its a welcome solution (1) I want the "additional" text box to ONLY display if the user answers the drop down list with "yes" (2) If the user answers "no" to the previous drop down list I don't want the "additional" text box displayed (3) When the form is originally...
1
2359
by: prathna | last post by:
Hi .. I have a logic:iterate tag which will display 5 rows each row with a drop downlist and 2 textfields.now by default all the rows will be shown.how do i hide all the rows except the first one.i know how to show/hide a row when its not dynamic.but i dont know how to do it when its logic iterate tag. <logic:iterate indexId="index" id="phoneItem" name="nameForm" property="results"> <% String dropdownType = "results.dropdownType";...
0
8266
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8705
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8638
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8365
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7196
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2626
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.