Hi,
I am trying to write a javascript to populate a "Textfield" based on what I select on a "Dropdownlist" this has a one on one relationship with each other. I tried to embed the script on "Change" category and the script was as follows but it did not work. I'd appreciate if someone can help me with the correct procedure.
Thanks,
Vijay
form1.#subform[0].DropDownList2[0]::change - (JavaScript, both)
function populateDescription(){
if (document.subform[0].DropDownList2[0].value=="BIH"){
document.subform[0].TextField83[0].value="Burn in and PBI History";
}
}
Solved! Go to Solution.
Views
Replies
Total Likes
I solved this same issue by using a switch script.
Please see my earlier thread regarding this and Paul's example will provide you with the proper scripting for a switch script.
http://forums.adobe.com/thread/479021
script on the drop down list as follows
switch (this.rawValue) {
case "dropchoice1"
fieldname1.rawValue = "text choice here";
fieldname2.rawValue = "text choice here";
break;
case "dropchoice2"
fieldname1.rawValue = "text choice here";
fieldname2.rawValue = "text choice here";
break;
}
Good luck.
Views
Replies
Total Likes
First, put your script on the click event of the drop down list rather than the change event. After that, try:
if (document.subform[0].DropDownList2[0].rawValue=="BIH"){
document.subform[0].TextField83[0].rawValue="Burn in and PBI History";
}
To shorten up your script a bit, you can also use:
if this.rawValue=="BIH"){
document.subform[0].TextField83[0].rawValue="Burn in and PBI History";
}
Views
Replies
Total Likes
Thanks a lot. I tried both and still wouldn't work
Views
Replies
Total Likes
Post a sample of your form and I'll try to get it working for you.
Views
Replies
Total Likes
Here's the sample... I want to populate the text field based on the selection on Drop down
BIH BURN IN & PBI HISTORY
FST FUNCTIONAL STRUCTURE TEST
MARKV MARK VERIFICATION
Thanks much.
Vijay
Views
Replies
Total Likes
I solved this same issue by using a switch script.
Please see my earlier thread regarding this and Paul's example will provide you with the proper scripting for a switch script.
http://forums.adobe.com/thread/479021
script on the drop down list as follows
switch (this.rawValue) {
case "dropchoice1"
fieldname1.rawValue = "text choice here";
fieldname2.rawValue = "text choice here";
break;
case "dropchoice2"
fieldname1.rawValue = "text choice here";
fieldname2.rawValue = "text choice here";
break;
}
Good luck.
Views
Replies
Total Likes
That's exactly what I wanted... it worked perfectly.
Thank you very much both of you.
Vijay
Views
Replies
Total Likes
I need to have a field auto-populate from three previous selections. Would this work for that? I am going to try and write it out below. I am sure the code will be wrong, but you get the idea (I hope!)
if Species.rawValue=="Human" AND Gender.rawValue=="Female" AND RefType.rawValue=="Standard"){
SampleRef.rawValue="Human";
}
Thanks for your help. Anne
Views
Replies
Total Likes
Well, I figured it out and this works, so I will post it here in case anyone else has the same problem.
if (Species.rawValue=="Human" & Gender.rawValue=="Female" & RefType.rawValue=="Standard"){
SampleRef.rawValue="HumanNCB137_XX";
}
if (Species.rawValue=="Human" & Gender.rawValue=="Male" & RefType.rawValue=="Standard"){
SampleRef.rawValue="HumanNCB137_XY";
}
if (Species.rawValue=="Human" & Gender.rawValue=="Unknown" & RefType.rawValue=="Standard"){
SampleRef.rawValue="Human";
}
if (Species.rawValue=="Human" & RefType.rawValue=="Custom"){
SampleRef.rawValue="HumanNCB137_XY";
}
Views
Replies
Total Likes
Views
Likes
Replies