Clicky

Drop down: Dropdown3
TextField: Text1

-----------------

I have a drop down with value 1, 2 and 3. I want to hide a text field when value of drop down is 2.

Need the JavaScript syntax. Thanks in advance for your help!

asked 12/13/2011 09:56

deharvy's gravatar image

deharvy ♦♦


11 Answers:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
function ex()
{
alert(document.getElementById("dropd'"))
if(document.getElementById("dropd'").selectedValue == '2')
document.getElementById("dropd'").style.display='none';

}
</script>
</HEAD>

<BODY>
<form>
<div id='div1'>
<input type='text'  id='txt'>
</div>
<select id='dropd' onChange='ex();'>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
</select>
</form>
link

answered

chaituu's gravatar image

chaituu

changed little bit

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
function ex(elm)
{
alert(elm)
var val = elm.options[elm.selectedIndex].value;
alert(val)

if(val == '2')
document.getElementById('div1').style.display='none';

}
</script>
</HEAD>

<BODY>
<form>
<div id='div1'>
<input type='text'  id='txt'>
</div>
<select id='dropd' onChange='ex(this);'>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
</select>
link

answered 2011-12-13 at 18:18:38

chaituu's gravatar image

chaituu

sorry you can also do like this.

{
alert(elm.value)
va

if(elm.value == '2')
document.getElementById('div1').style.display='none';

}
link

answered 2011-12-13 at 18:22:26

chaituu's gravatar image

chaituu

1:
2:
3:
4:
5:
6:
7:
function ex(elm)
{

if(elm.value == '2')
document.getElementById('div1').style.display='none';

}
link

answered 2011-12-13 at 18:23:52

chaituu's gravatar image

chaituu

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
function ex(elm)
{

if(elm.value == '2')
document.getElementById('txt').style.display='none';
else
document.getElementById('txt').style.display='';
}
</script>
</HEAD>

<BODY>
<form>
<input type='text'  id='txt'>
<select id='dropd' onChange='ex(this);'>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
</select>
</form>
</BODY>
link

answered 2011-12-13 at 18:24:31

chaituu's gravatar image

chaituu

Will this work in Adobe Acrobat?
link

answered 2011-12-13 at 18:25:38

deharvy's gravatar image

deharvy

i hav not tested  .you test and let me know.
link

answered 2011-12-13 at 18:35:44

chaituu's gravatar image

chaituu

Doesn't seem to work.

I think this is what I need but not sure how to apply it: http://forums.adobe.com/message/3946903
link

answered 2011-12-13 at 18:58:43

deharvy's gravatar image

deharvy

Ok. After much research, I was able to figure out the steps. In Adobe Acrobat, you go to the properties of the ComboBox.

1. Go to the Actions tab.
2. Mouse Enter should be the Trigger.
3. Run a Javascript.

I've attached the code example that works for me.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var a = this.getField("DropDown3");
var b = this.getField("Text1");

if (a.value == "Yes") {
 b.display = display.visible;
} else if (a.value == "No") { 
 b.display = display.hidden;
} else if (a.value == " ") { 
 b.display = display.hidden;
}
link

answered 2011-12-13 at 19:52:18

deharvy's gravatar image

deharvy

Thanks for all your help in getting me thinking in the right direction.

link

answered 2011-12-13 at 23:53:50

deharvy's gravatar image

deharvy

thanks for the points
link

answered 2011-12-13 at 23:55:40

chaituu's gravatar image

chaituu

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

Asked: 12/13/2011 09:56

Seen: 302 times

Last updated: 12/17/2011 05:21