Ajax :: Show Region If Option Selected
Jan 29, 2010
I have a PHP form, with a Customer Select List. Once an option has been selected, the 'custid', is passed to Javascript that collects all the contacts linked to that customer and populates another Select List. This works fine, but what I'm after is an extra two inputs to appear when a particular customer is selected, but I'm not entirely sure how to go about it.
Here it goes:
Table/Form:
Code:
<script type="text/javascript">
var ajax = new Array();
function getTextList(sel) {
var Customer = sel.options[sel.selectedIndex].value;
document.getElementById('text').options.length = 0;
if(Customer.length>0){
var index = ajax.length;
ajax[index] = new sack(); .....
View 2 Replies
ADVERTISEMENT
Apr 24, 2010
ive been racking my brain looking for a code solution for this....im a html and css pro....and a javascript heres what im tryna do....i have a form...that has a <option> in it for 6 dropdown options.... in one of those possible options.. when SELECTED...i want the div layer that i currently have under it...to appear and i cant seem to figure it out....heres my code in its entirety i want budget div...to appear when the option website design is selected
[Code]....
View 2 Replies
View Related
Dec 15, 2011
I'm new to JavaScript. I'm trying to create my form in such a way that if 'Premium' is selected, a the text box with label 'membership no' is displayed and if 'bronze' is select, the drop-down list 'sponsor' is displayed instead....here's what my form looks like...
<form id="form1" name="form1" method="post" action="">
<p><label for="select">Membership:</label>
<br /><select name="select" id="select">
<option value="Premium" selected="selected">premium</option>
<option value="Bronze">bronze</option>
</select></p>
<p>Membership No:<br />
<input type="text" name="textfield" id="textfield" />
</p>
OR<br />
Sponsor:
<br />
<select name="select2" id="select2">
<option value="329">329</option>
<option value="234">234</option>
</select>
</form>
View 4 Replies
View Related
Jan 11, 2012
So far i managed to show/hide (the only) 1 textarea if an option is selected, using javascript. How can i show all textareas in form if an option is selected (lets say <option name="active">) and hide if option selected is name="passive"?
View 1 Replies
View Related
Oct 7, 2010
I have the following dropdown list box [code]...
I want to show() a textbox and a label based on someone selecting the "is between" option of the dropdown list.
I have multiples of these dropdowns and all of them will have to do the same thing. In other words I have
DDLConditional1 2 3 4... infinite. I've already been able to make the button work that appends new conditionals.
View 1 Replies
View Related
Nov 13, 2010
I've tried to find a stright forward script which show/hide specific form fields based on a selected option. I've seen many online but non of them was working with me without the need of some coding or tweeks. Does anyone here have such script?
View 4 Replies
View Related
Nov 26, 2006
Does anyone know of a Javascript that will show an amount in a drop down based on what was selected in the previous drop down? Example: Code:
<select id="car">
<option value="volvo">Volvo</option>
<option value="audi">Audi</option>
</select>
<select id="price">
<option value="">Please select</option>
<!-- show this if volvo -->
<optgroup id="vol">
<option value="30000">30000</option>
<option value="31000">31000</option>
</optgroup>
<!-- show this if audi -->
<optgroup id="aud">
<option value="40000">40000</option>
<option value="41000">41000</option>
</optgroup>
</select>
View 9 Replies
View Related
Jun 7, 2005
Hoping someone could solve this small problem of mine. I have numerous regions on a page that can be hidden/shown, the problem is i get a 'Line 8 Character 30 'id' is not defined' javascript browser error, but it works!
here is the code the error appears in:
PHP Code:
<script language="javascript" type="text/javascript">
/* This goes in the head section */
window.onload = function() { document.getElementById(id).style.display = 'none' }
function toggle(link, id) {
var div = document.getElementById(id);
if (div.style.display == 'none') {
div.style.display = 'block'
link.innerHTML = 'Hide Forms'
} else {
div.style.display = 'none'
link.innerHTML = 'Show Forms'
}
}
</script>
The code for the hide/show region is below.
PHP Code:
[ <a href="#id3" onclick="toggle(this, 'id3'); return false;">Show Forms</a> ]</div>
<div id="id3" style="padding: 10px; display: none;">
SHOW/HIDE CONTENT HERE!
</div>
View 4 Replies
View Related
May 31, 2010
The code below works perfect in Firefox, not in IE8.
<script language="javascript" type="text/javascript">
HTML:
View 5 Replies
View Related
Mar 11, 2006
In the code below I want to alert the selected option of select.
In Mozilla the code works (If I choose "3" alerts it).
In IE alerts: nothing appear
---------------------
<script>
function hi() {
d = document.getElementById("day").value;
alert(d);
}
</script>
<select id=day onchange="hi();">
<option>0
<option>1
<option>2
<option>3
<option>4
</select>
---------------------
View 6 Replies
View Related
Sep 12, 2006
if I have a select with more options,
how I can know if is there an option selected;
is necessary a cycle? or is there an inner property?
View 6 Replies
View Related
Dec 4, 2010
I'm trying to update a part of my page depending on the option selected from a drop down menu. A few of the options can trigger this event. So to do this i've given those options a class name, that i can check against when they're selected. eg...
Code:
So if 'test2' or 'test4' are selected it will check if the class name is present then do the rest. But I cant get the class name from JQuery. I've tried..
Code:
View 1 Replies
View Related
Sep 9, 2009
I have a select box with a few options. When the page loads I need to get the selected option in this select box and alert its inner text. Yet everything I try out on the net that should work wont work in IE, all other browser its fine. show me the TRUE and correct way to get the inner text of a option from a select box in IE?
View 5 Replies
View Related
Aug 3, 2010
I have multiple select boxes that have various options such as 'bangles', 'rings', 'earings' etc and I have a div that doesn't display until an option has been selected from one of the select boxes. If the option 'rings' is selected I don't want to display the div '#size'.
Jquery function:
The trouble I'm having is that I can't figure out how to use $(this) with option:selected. if I simply put the id of one of the select boxes then it works, but only for that one select box. I want it to be dynamic.
View 1 Replies
View Related
Jan 24, 2011
I have a form and I generate a select menu with javascript.
I need to select by default an option element passed as parameter to the page with the form.
Now I've got this [code]...
The code will execute only once the instruction inside the "if" on line 14 and that option element must be set as "selected", how can I do that?
View 1 Replies
View Related
Apr 19, 2010
Basically, I have a <select> drop down with a bunch of <option>s, each with an onmouseover command. The problem is that if I click on one of the options, it loses its mouseover effect. Here's the code:
Code:
<select>
<option onmouseover="tooltip('Some stuff')">Blah</option>
<option onmouseover="tooltip('Some more stuff')">More blah</option>
<option onmouseover="tooltip('Even more stuff')">Blah blah blah</option>
</select>
The tooltip() function creates a basic tooltip. While the drop-down menu is open, the onmouseover functions work just fine. It's when the option has been selected that it stops working.
View 1 Replies
View Related
Jul 23, 2005
I have a select box with about 5 options. I need to have one of the options, when selected, display a second select box.
The second select box is populated by a database and needs to be preloaded
so the page doesnt refresh. How can this be done?
I guess could have the second select box displayed but disabled and it would
become active once the option is selected on the first select box.
View 2 Replies
View Related
May 10, 2011
I have2 select boxes with 2 options. If I change the first box I want to reset the second box.
I have tried on Change, setting thesecondselect box val but this does not work.
Here is my code.
If i change box 2 and then change box 1 it never resets box2 to 0...
View 3 Replies
View Related
Mar 16, 2011
I am trying to make a form that collects "Number of Children" a parent has. If they select "4" from the select input, then I want to slidetoggle out the appropriate divs, one for each child.
[Code]...
I have been able to use slidetoggle in the past when attached to a button, but this one has me lost. Anyone know how to accomplish this?
View 1 Replies
View Related
Feb 14, 2011
i have listbox that when a user selects option(s) I want to see if the "--ALL--" option text is selected and then do something.. basically
for each selectedoption.text that contains "--ALL"
$('#lstBusinessUnitSource option[value*="' + $(this).val() + '"]').remove();
here is my code..
$(
"lstDivisionSource option:selected").each(function () {
alert($(
[code]....
View 1 Replies
View Related
Oct 24, 2009
There appears to be no difference between these two when the page loads.
<select id="one">
If there is no "selected" then it always defaults to first value.
How can I tell if the page has loaded and no options have been selected?
View 2 Replies
View Related
Jun 11, 2009
How can i check in a poll which radio button was selected?
View 2 Replies
View Related
Aug 2, 2010
I have an html drop down list. the list has an 'other' option. when the other option is selected I want a text box to pop up to the left of it for entry. I was thinking about using a hidden <div> to contain the text box. and when other is selected to unhide it. How do I unhide it when other is selected?
View 1 Replies
View Related
Nov 30, 2009
Here is my options select from my form. Its dynamically generated with php.
Code:
<select id="upgrade[]" name="upgrade[0]" onchange="javascript:calTotal(this);">
<option value="1">1</option><option value="2">2</option>
</select><br />
<select id="upgrade[]" name="upgrade[1]" onchange="javascript:calTotal(this);">
<option value="1">1</option><option value="2">2</option>
</select><br />
<select id="upgrade[]" name="upgrade[2]" onchange="javascript:calTotal(this);">
<option value="1">1</option><option value="2">2</option>
</select><br />
Using javascript I want to get the selected value. Here is what I have, but its getting no where:
Code:
function calTotal(aVar)
{
var c = document.getElementsByName(aVar);
c = c.length ? c : [c];
for(var i=0; i<c.length; ++i)
{
if(c[i].value==1)//I am getting undefined here
{
}
}
Is there a way to loop through an array of option selected like the one I have here?
View 4 Replies
View Related
Nov 18, 2010
I have a simple form with an options drop down box:
<form method="POST" name="form">
<select autocomplete="off" id="input" name="input" onchange="this.form.submit();goHere();">
<option>Choose...</option>
[code]....
I wish to identify the option chosen in the function but not by its value, by its position:
<script>
function goHere(){
var s = document.getElementById("input");
[code]....
I was hoping that variable "u" would be either 0, 1, 2, or 3.How can I get a variable to alert me the position of the selected option in the form? I think it is elements[i].
View 11 Replies
View Related
Apr 8, 2011
I have a dropdown box with 2 options: Free or UpgradedI need to do 2 separate things depending on which one is chosen.If Free, then set the value in fourth text field to 9999else, set value in Fourth field to 5555.
<head>
<script type="text/javascript">
function calculate()
[code]...
View 4 Replies
View Related