I am creating a form that has a dropdown with different types of products listed. After a person selects a product from the menu I would like to populate the text box with a description of the product. I am a beginner here but I thought their was away to use JavaScript to do this. But wasn't exactly sure where to put the code and do I put it on the text box or the dropdown. Any help would be appreciated Ive been looking all over for a week and can find an answer.
Solved! Go to Solution.
Views
Replies
Total Likes
if (xfa.event.newText==" ")
{TextField1.rawValue=""}
Place on your drop list using Java Script on the *change event"
If you had three items in your list:
A
B
C
if (xfa.event.newText=="A")
{TextField1.rawValue="You chose the letter A"}
if (xfa.event.newText=="B")
{TextField1.rawValue="You chose the letter B"}
if (xfa.event.newText=="C")
{TextField1.rawValue="You chose the letter C"}
Views
Replies
Total Likes
if (xfa.event.newText==" ")
{TextField1.rawValue=""}
Place on your drop list using Java Script on the *change event"
If you had three items in your list:
A
B
C
if (xfa.event.newText=="A")
{TextField1.rawValue="You chose the letter A"}
if (xfa.event.newText=="B")
{TextField1.rawValue="You chose the letter B"}
if (xfa.event.newText=="C")
{TextField1.rawValue="You chose the letter C"}
Views
Replies
Total Likes
I would place the javascript code to change the value of the text box in then change event of the dropdown. The code would look something like this.
if(this.rawValue == "Item 1")
textBox.rawValue = "description 1";
If you didn't want to use an if statement you could use a switch statement then the code would look like this.
switch(this.rawValue)
{
case "Item 1":
textBox.rawValue = "description 1";
break;
case "Item 2":
textBox.rawValue = "description 2";
break;
default:
textBox.rawValue = "";
}
I hope this helps.
DG
Thanks paulk07 so much that worked perfectly.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies