473,766 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamiccly show/hide text boxes

6 New Member
I have a from with three radio buttons (same group) and three text boxes. The radio buttons give the user a choice of uploading one, two, or three images. Currently, I have the text boxes load as disabled and the radio button selection enables the needed text boxes. It works but...

I don't want to see the text boxes unless they are needed and I want the user to be able to change their mind. (ie choose three images or go back to one image)

this is what I am using right now:
Expand|Select|Wrap|Line Numbers
  1. <table width="800px"> 
  2. <tr>
  3. <td>
  4. <!--Select how many images and disable unused text boxes--> 
  5. <form action="code.php" method="post">
  6. <input type="radio" name="myRadioButton" value="1" onclick="image1.disabled=false;" /> 1 Picture
  7. <input type="radio" name="myRadioButton" value="2" onclick="image1.disabled=false; image2.disabled=false;"/> 2 Pictures
  8. <input type="radio" name="myRadioButton" value="3" onclick="image1.disabled=false; image2.disabled=false; image3.disabled=false" /> 3 Pictures
  9.  
  10.  
  11.  
  12. <!--Information-->
  13.  
  14.   <p>Enter the Auction Title:
  15.   <input type="text" name="title"  cols="50" />
  16.  
  17.   <br />
  18.   <br />
  19.     Enter A Description: 
  20.   <textarea cols="50" rows="10" wrap="soft" name="description"></textarea>
  21.   <br />
  22.   <br />
  23.     Enter the URL for Image 1: <input type="text" name="image1" disabled="disabled" />
  24.   <br />
  25.   <br />
  26.     Enter the URL for Image 2: <input type="text" name="image2" disabled="disabled" />
  27.   <br />
  28.   <br />
  29.     Enter the URL for Image 3: <input type="text" name="image3" disabled="disabled" />
  30.  
  31.   </p> 
  32.   <p>
  33.  
  34.  
  35.  
  36.  
  37.     <input type="submit" name="submit1" value="Generate Auction Code"/>
  38.   </p>
  39.  
  40. </form>
  41. </td>
  42. </tr>
  43. </table>
Apr 25 '09 #1
1 2570
gits
5,390 Recognized Expert Moderator Expert
you may use the style.display property to do so ... let me give you a simple example for it:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function toggleVisibility(checkbox, nodeId) {
  5.     var node = document.getElementById(nodeId);
  6.     node.style.display = checkbox.checked ? 'block' : 'none';
  7. }
  8. </script>
  9. <body>
  10.     <input type="checkbox" onclick="toggleVisibility(this, 'foo');"/>
  11.     <input type="text" id="foo" style="display: none;"/>
  12. </body>
  13. </html>
  14.  
kind regards
Apr 26 '09 #2

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

Similar topics

10
4656
by: oLE | last post by:
I would like to add some javascript to show/hide a certain row of a table. The first row of the table contain the hyperlink that calls the javascript the second row is the one i want to show/hide with the javascript in a toggle fashion. the problem is a know very little javascript and have become incredibly frustrated because i went ahead thinking it was going to be like C. its not. I know i can use these lines to do the actual work:
7
10175
by: Mark | last post by:
Hi All, I have a report which is based on a query which is used to produce QC check sheets. I have quite a few text boxes which are used to display questions depending on the value of one particular field which will have either a "H" or "B" value. e.g. =IIf(="H"," Does the multipack Qty match the paperwork"," Is the outer label positioned correctly") My problem is that there are more questions for hanging types than boxed.
5
3617
by: tlyczko | last post by:
Hello, I've searched on toggling divs and didn't really find what I was looking for, I saved a bunch of different threads. I have a form with several different text boxes for things like dates, numbers, etc. arranged in a table, each row has the same kind of text boxes for data entry (10 rows probably). I want to have a separate section above the form where I can toggle a div containing an appropriate error message to appear after the...
8
2488
by: Andrew | last post by:
Hello, friends, We created a drop-down menu bar and a show/hide calendar web user controls mainly using javaScript and html. However, they both have the problem that they are not dispaly as the top controls in IE browser. Rather, text box, file field, and etc. are on the top. As a result, our calendar and drop-down menu bar were "cut" here and there wherever there is one of those boxes.
1
16757
by: asilverpeach | last post by:
Hey Guys! Found some great scripts here on this topic but have to make to changes to the code that I can't seem to figure out. First, In the following code clicking on the headers shows the div information. I want a nested show hide element though. So when you click on "Do you have carpets to be cleaned?" Small Rooms & Medium Rooms appears (that I got working) But Then when you click on Small rooms or medium rooms i want the three lines...
5
8439
by: ali | last post by:
Hello every one i need you help regarding div hide and show. i am having a link like <a href="#" onClick="expandWin()">show/hide </a> <div id=showHide> </div> within div i have lots of form tags and div elements say n. The problem
1
4173
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...
3
3620
by: spranto | last post by:
Hi to you all once again, I'm dealing with user point of view difficulties. I have a 3x3 "matrix" made with text boxes. Some cases require only 2x2. My problem is: How do I hide, or lock (making unable to write), the text boxes that are not going to be used? I was thinking that a drop down menu could give the program the initial conditions such as: case 1 -> 3x3 (default) case 2 -> 2x2
1
3811
oranoos3000
by: oranoos3000 | last post by:
hi would you please help me i have a online shopping center that i show pictures of the my product in home page. in the InterExplorer pictures is shown correctly but in Firefox browser is shown properties alt in img tag istead of picture . place of the pictures is saved in the database(my database is with mysql) and in home page i fetch properties of the product and address of place that pictures is located output of the code in the...
0
9568
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
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
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...
1
9959
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
9837
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...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5279
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...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.