Changing Visibility Depending On Dropdown Box Selection

Aug 18, 2002

I want a text box which is only visible if the preceding drop down box has a certain option selected. Does anyone know how to do this or where I might be able to find the appropriate code?

View 7 Replies


ADVERTISEMENT

Textarea Visibility Based On Dropdown Selection?

Feb 1, 2009

I have a form which has a dropdown menu on it. The last option on the menu "other". When "other is clicked, I would like a textarea to become visible, so that the user can enter the new information. Does anyone know how I might do this?

Here is the html for the form:

HTML Code:
Union: <select name="union" id="union">
<option value="choose">Choose One</option>
<option value="ibew">International Brotherhood of Electrical Workers</option>
<option value="ibt">International Brotherhood of Teamsters</option>

[Code]....

View 6 Replies View Related

DropDown List Popup Depending On Selection?

Oct 27, 2010

Here is my dropdown menu:
<select name="peeps">
<option value="Frank Tompson">Frank Tompson</option>
<option value="Henry Wilson">Henry Wilson</option>
<option value="Bill Kent">Bill Kent</option>
<option value="Jessi McDonald"> Jessi McDonald</option>
<option value="John Hays">John Hays</option>
How can I make it so if I click on John Hays a JavaScript pop up will say Hello John Hays, and if I click on Bill Kent a popup will say hello Bill Kent and if I click on any other name nothing happens?

View 3 Replies View Related

DropDown Change Background Image Depending On Selection

Sep 21, 2010

The code below lets a user select a drop down option and a picture changes depending on the selection. I am trying to make it so when you select an option on the dropdown the picture shows up in the center of the screen and in the background behind the text. Here is the code.

<html>
<head>
<style type='text/css'>
#txt {background-repeat:no-repeat;width:200px;height:200px;}
</style>
<script type='text/javascript'>
function div_bg(team){
document.getElementById('txt').style.backgroundImage="url(images/" + team + ".jpg)";
}

</script>
</head>
<body>
<select name='team' onChange='div_bg(this.value);'>
<option name='arsenal' value='arsenal'>Arsenal</option>
<option name='liverpool' value='liverpool'>Liverpool</option>
</select>
<div id='txt'></div>
</body>

View 19 Replies View Related

JQuery :: Making Dropdown Show / Hide Depending On Selection

Jan 10, 2011

I have the following code that generates two dropdown boxes in a form, but I would like for the second to be hidden unless the first has 'Software problem' selected. Is it possible to do this?

<p id="parent-menu">
<select name='helpdesk-category' id='helpdesk-category' class='dropdown' tabindex="40">
<option value='-1'>Select a Category</option>
<option class="level-0" value="13">Software problem</option>
<option class="level-0" value="14">Hardware problem</option>
<option class="level-0" value="15">Suggestion</option>
<option class="level-0" value="16">General query</option>
</select>
</p>

<p id="toggle-menu">
<select name='software-category' id='software-category' class='dropdown' tabindex="50">
<option value='-1'>Select a Program</option>
<option class="level-0" value="6">BigHand</option>
<option class="level-0" value="7">IRIS</option>
<option class="level-0" value="8">MS Outlook</option>
<option class="level-0" value="9">MS Word</option>
<option class="level-0" value="10">MS Excel</option>
<option class="level-0" value="11">Oyez</option>
<option class="level-0" value="12">Internet Explorer</option>
</select>
</p>

View 2 Replies View Related

Changing Default Of DropDown List Depending On User URL

Sep 2, 2011

I have a form that I am using for several different pages as they are exactly the same... however at the top you must make a choice from the drop down box that then shows the appropriate fields to fill in. Can I make the drop down default to a certain option depending on which page they are coming from?

View 3 Replies View Related

Changing Visibility Of DIV

Aug 18, 2006

I would like to change the visibility of the contents of a DIV by clicking a button or link. If possible, I'd like the button to toggle the visibility on/off. If not, I'll just have two buttons, one to make it visible, the other to hide it.

Also, I'd like the page content under the DIV to move up/down as the DIV is hidden/visible (as if the text inside the DIV did not exist when the it was hidden).

The code I tried before posting was this:
function visibility(id){
document.getElementById(id).style.visibility=hidden;
}
I couldn't find any documentation on the Visibility property, so I didn't know how to use it correctly. Also if there is a better way to achieve the effect I want than using style.visibility, please post it.

View 3 Replies View Related

Changing DIV Visibility

Jun 19, 2006

I want to add a caption to certain images on a website I'm building when the user moves their mouse over it, along the lines of "Click to Enlarge". The HTML code I've got is as follows:

<div class="overlay">
<a href="#"><img src="image/example-4.jpg" alt="Example Image" /></a>
<div><p>Click to enlarge image</p></div>
</div>
The DIV with the caption is set in the CSS to display:none; and I have the following JavaScript code which is supposed to change this property to block on hover:

window.onload = function(){
var overlay = document.getElementsByTagName('div');
for(var i=0; i<overlay.length; i++){
if(overlay[i].className == 'overlay') {
overlay[i].onmouseover = function() { this.getElementsByTagName('div').style.display = 'block' }
} } }

But this gives this error:

Error: this.getElementsByTagName("div").style has no properties
Any idea what I've done wrong?

View 5 Replies View Related

JQuery :: Dropdown Menu Selection Dynamically Alters Selects Of Other Dropdown Menus On Same Page?

Jul 24, 2010

I have a project where I need a selection of one dropdown menu may affect the select of multiple other dropdown menus on the same page.First, a table is generated, and within each row, it contains a dropdown menu. Assume: Rows A, B, C, etc..., and Dropdown selection: 1, 2, & 3If dropdown in Row A selects 2, then I want the selection of dropdowns in rows B & C to dynamically change to 2.And if in Row C user selects 3, then the selection in dropdowns in rows A & B should dynamically change to 3.

View 1 Replies View Related

Hide Fields Depending On Selection

Sep 1, 2009

In the following code I am attempting to get certain fields to only appear if the user Selects dependent else those fields should be hidden.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"[URL]">
<html xmlns="[URL" xml:lang="en" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>Display and Hide</title>
<script language="JavaScript">
function showhidefield(){
if (document.HelpAdd.RecordType.value == "Parent"){
document.getElementById("hideablearea").style.visibility = "hidden";
} else {
document.getElementById("hideablearea").style.visibility = "visible";
} }
</script>

</head>
<body>
<form name='HelpAdd' action='nextpage.asp'>
<table align="center" border="3" cellspacing="0" cellpadding="3">
<tr><td>Record Type:</td>
<td><select id="RecordType" name="RecordType" onchange=showhidefield()>
<option value='0'>Parent</option>
<option value='1'>Dependant</option><br/>
<tr><td>Topic Title:</td>
<td><input type="text" name="TopicName" ID="TopicName" maxlength="25"></td></tr>

<div id='hideablearea' style='visibility:hidden;'>
<tr><td>Parent:</td>
<td><select name="Parent">
<input type="text" name="ParentID" ID="ParentID" maxlength="25"></td></tr>
<tr><td>Topic Body:</td>
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $MaxFileSize ?>" />
<td><input id="helpfile" name="helpfile" type="file" /></td></tr>
</div>
<tr><td colspan="2" align="center">
<input type="submit" name="submit" value="Submit">
<a href="/help.php"><button>Back</a>
</td></tr>
<tr><td colspan="2" align="center">
<?php echo $Message ?>
</td></tr>
</table>
</form>
</body>
</html>

View 4 Replies View Related

Change Second Menu Depending On Selection In First

Feb 15, 2009

Basically I have a form, with two simple select menus, both identical except for different name values to post:

HTML Code:
<p>Make current?</p>
<select name="is_current">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<br />

<p>Put in list?</p>
<select name="in_list">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>

Some PHP code governs whether the "yes" or the "no" option in either menu gets the 'default' "selected="selected" showing, based on database information. For instance, in the first menu, if the page deals with a case where the the first "is_current" value is indeed current, then the PHP code will write the default "selected="selected" for "yes":

HTML Code:
<select name="is_current">
<option value=yes" selected="selected">Yes</option>
<option value=no">No</option>
</select>

If the page deals with a case where the value isn't current, the selected="selected" code will be written for the "no" value instead. The same goes for the second select menu. Now, the logic of my situation requires that, if the user selects "Yes" in the first "is_current" drop-down, then only "Yes" should be available to select in the second "in_list" menu. Anyway, I don't know javascript very well, but I found a function that seemed to be able to do this.

Code:
<script type="text/javascript">
(function () {
function updateLevel() {
var limit = Number(this.value);
// find the next select element
var selects = this.form.getElementsByTagName('select');
var select;
for (var i = 0; i < selects.length; i++) {
if (selects[i] === this && selects[i+1]) {
select = selects[i+1];
break; .....

(Apparently the script has to be put or called just before the </body> tag at the end of the page.) Then the select menus are recast as:

HTML Code:
<p>Make current?</p>
<select name="is_current" id="in_list">
<option value="1">Yes</option>
<option value="2">No</option>
</select>
<br />

<p>Put in list?</p>
<select name="in_list">
<option value="1">Yes</option>
<option value="2">No</option>
</select>

Now this appears to work, up to a point. If the user selects "Yes" for the first "is_current" selection, then only "Yes" becomes available for selection in the second "in_list" menu. A posted value of "1" represents "yes", and a value of "2" represents "no". Except, in Firefox, the javascript somehow overrules the default selected="selected" code. That is, the source code in the browser is correct, but the javascript draws it incorrectly.

For instance, say the database/PHP has drawn selected="selected" for the value "yes" in the second menu. Even though I can see that the source code is OK in the browser, the javascript will make the browser show a "No" selection as the initial default. This happens in Firefox, though not in Safari, and I haven't tested other browsers yet. This may be obvious but I'm not sure of javascript.

View 11 Replies View Related

Changing Text, Visibility And To A Submit Button?

Apr 26, 2011

I initially have some text, say some text A and a button with value "SIGN IN". When the user presses the button, I want the text to change to say some other text B a text field that was hidden to appear and the value of the button to change to "Submit". I wonder if someone could provide with me efficient and robust code (mine is neither). The properties for the text, text field and button lie in a CSS file, e.g.

Code:
input[type="text"]
{ width:150px;
display:block;
margin-bottom:10px;

[Code].....

View 1 Replies View Related

Display Specific Input Fields Depending On Combobox Selection?

Nov 5, 2009

Within a classic asp webform (using vbscript) I would like part of the form (input boxes within table structure) to be specific/displayed depending on the users selection from the combo box in the row above.

I think the best solution would be using Javascript can anyone suggest a solution or example code?

View 1 Replies View Related

Change Background Picture Depending On A Drop Down Field Selection?

May 19, 2010

I need to achieve two things upon making a selection from a drop down field:

1) Changing the background picture of a cell.

2) Changing the size of a uploaded foreground picture within the same cell. code...

View 4 Replies View Related

Show / Hide Depending On Form Selection - How Best To Arrange Data

May 13, 2009

I have a big form which I'm tidying up by only showing elements when they become relevant, based on the currently selected input (eg to only show an option for 'waist size' when garment type 'jeans' has been selected). I've done this many times, and probably used a different approach each time, so I just wanted to see what other people do. It's currently along these lines: "If a particular option is selected, then show this element, otherwise hide it".

Code:
//the onclick handler
function checkViewType() {
//go through radio inputs in the cell and check what's clicked
document.getElementById('supplierOptions').style.display=radioCollection.supp.checked?"":"none";
document.getElementById('subCatOptions').style.display=radioCollection.subcat.checked?"":"none";
document.getElementById('subCatTimeOptions').style.display=radioCollection.subcat_sumtype_time.checked?"":"none";
document.getElementById('subCatSumOptions').style.display=radioCollection.subcat_sumtype_sum.checked?"":"none";
document.getElementById('subcat_weekmonth_span').innerHTML=radioCollection.subcat_time_week.checked?"week":"month";
}

But it's a big form, with lots of nested options, and some elements can be triggered visible by several different options. So I'm looking for an elegant way to handle this without a million if..elses. Perhaps an array of element ids and which elements are allowed visible when that's selected.

View 4 Replies View Related

Copy Dropdown Selection To Another Dropdown?

Sep 6, 2011

I have two drop-down prompt controls with month names. One has just one value (say "July") and the other has all the months of the year ("January".."December"). The first prompt control is hidden on the page. How do I set the default selection of the second prompt control to the value present in the first prompt control? So, when the page is run, the second prompt control should automatically show "July".

I was reading up on the selectedIndex property (?), but I know that it won't work because I want Index 0 to be selected in the first control and Index 6 in the second, and I expect it to change every month (next month it will be index 7 that should be automatically selected).

View 2 Replies View Related

Direct To Webpage Depending On Combobox Selection When Submit Button Clicked?

Sep 16, 2009

I've created a form with combobox with different values (this is for my website). What I want is when the user clicks 'submit' that it goes to a different page on the website depending on the value the person has selected in the combobox. Values are numerical, for example 1000, 2000, 5000 etc. I've been trying this for a couple of days now without success!

View 10 Replies View Related

Show / Hide Form Fields Depending On Radio Button Selection

May 29, 2005

How to show and hide form fields depending on a selected radio button.

View 14 Replies View Related

Changing 2nd Or 3rd Link Css Depending On Page?

Jul 24, 2009

i have a div which has an id in that i have a div which has a class name then i have a table in the second div and in that i have few links (ie. <a href=...</a>)

<div id="nav">
<ul>
<div class="moduletable_menu">

[code]....

View 2 Replies View Related

Depending On Radiobutton Diffrent Option Show In Dropdown Box?

Feb 11, 2011

I am trying to make a form that after selecting a certain RadioButton i want the value of that radio button to be changed in to a JavaScript varible, iv tried document.myform.RType.value but wont seem to work.Currently in this code i am simply trying to disply the value of the RadioButton selected in the drop down box just so i know its working. I will then work on changing value of the drop down box depending on the RadioButton choice. So if anyone could help with the getting radio button value to a varible that would be great and advise of the changing value depending on radiobutton vlaue that would be amazing.

Code:
<body>
<h2><span><a href="#" onclick="expandSection('section1')">Basket click to expand</a></span></h2>
<div id="section1" class="section">
<span>

[Code]...

View 6 Replies View Related

Javascript Changing The Options Of The Second Select Box Depending On The First

Oct 17, 2007

I have two text boxes one with months in "January, Febuary..." but as not every month has the same ammount of days i need the second select box to change to instead of having options 1-30 it has 1-28 or what ever depending on what month is selected.

View 1 Replies View Related

JQuery :: Changing Style On Series Of DIV Depending On Children

Oct 14, 2010

How to change style on a series of divs (with similar structure but different content) *only if* all the children are visible (that's using visibility, not display).
Sample div:
<div class="h">
<p class="a1">text</p>
<p class="b2">more text></p>
<p class="b3">text text</p>
<p class="a4">text...</p>
<p class="link_display_none_visibility_visible">div name</p></div>
I think it needs to use contents(), but not sure about handling node numbers.

View 5 Replies View Related

Changing Text Depending On Section Of Content Area

Jun 11, 2010

This is what I want to achieve: a fixed positioned div next to my content area where the text changes depending on the section of the content area the user is reading. Can this be achieved, and how?

View 9 Replies View Related

Disable A Dropdown List Based On Selection In Another Dropdown List?

Apr 20, 2011

I have two dropdown lists with the second one being dependent on the selection in the first.

Options in list 1: 1,3 or 4

List two should be enabled when 3 or 4 is selected in list 1.

So far so good, managed to get it to work with only one set of lists, but I actually have 18 of those sets in this form:

<select name="fw[$i]" id="fw[$i]">
<option value="1">FWH</option>
<option value="3">links</option>
<option value="4">rechts</option>

[Code]....

I'm not that adept in javascript programming, more like a trial and error guy, how has hit the wall with this problem.

View 20 Replies View Related

JQuery :: Changing Classes Of List Items Depending On The Amount Of Them And Current Class Name?

Mar 28, 2011

I'm trying to create a list that contains items which are filters for a search. The list shows 10 items (max) on the page load. if there are more than 10 it changes the class of the elements > 10 so they are hidden, and a 'show more' link is appended. Now if the user has 'unhidden' the previously hidden items and then chooses one, I want the class for all those previously hidden items to change until the user has deselected that item.

[Code]...

Is there a better, smaller way to write this? It works for what i need currently, but there are future features im planning that will not be practical checkingindividualindexes the way i've done it.

View 5 Replies View Related

Hiding Row With Dropdown Selection

Nov 10, 2010

I've got a dropdown and I need for it to open up a row directly below it if the user selects "Yes". I've tried all morning and cant get it to work at all.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved