You need to sign in to do that
Don't have an account?

Write text to a text field based on picklist selection
Hi,
I need to have a picklist with values for example: ( Template 1, Template 2, Template 3 ) Anytime time this pick list's selection is changed I need to place different text value in a text field corresponding to a custom field.
I tried with an s-control and some javascript, however I was wondering if anyone managed to do this with a visual force code?
I would do something like this. I just whipped this up in notepad real quick so there may be some typos.
All Answers
Where is the text value coming from? Is it stored in an object or hardcoded?
Why you are using a text field.What did't used a picklist data type.If you used picklist data type it is simple getting label values through apex and scontrols(Regarding scontrols check the documentation still i also have doughty it is compiling or not)
It's absolutely possible using an actionSupport control.
Here I'm using a selectList (I didn't specify the exact attributes of the selectList, but they are largely irrelevant), but it should also work fine as an outputField attached to a picklist field as well.
Note that the rerender attribute on the actionSupport is vital as without a rerender attribute, a full page rerender occurs (actually the action method returns a null PageReference, which amounts to the same thing).
The controller would need to have the referenced action method:
-Mike
Thanks for everyones' input.
I will try to re-phrase my question I am not sure if people understood my question.
I need to have a picklist with certain values for example: Sample 1, Sample 2, Sample 3, when a selection is made on this picklist each value corresponds to a text string for exampkle Sample 1 = This is sample template text, Sample 2 = This is another sample text.
I have a field on the same page that need to be updated with the sample text depending on the picklist value.
Thanks once again.
After getting the text just update the field based on condition.
I understand the question. I am asking where you are storing the sample text so I can give you a full example.
Your help is very much appreciated.
The text could be stored/hard coded to a variable for now.
Thank you.
I would do something like this. I just whipped this up in notepad real quick so there may be some typos.