You need to sign in to do that
Don't have an account?
Kunlun
How to set the text value in lookup field
Hi,
I would like to create a visual force page, which contains lookup fields.
And I would like to set some basic value in lookup field text box. So that user can click the "lookup" button to query with some basic condition.
For example:
<inputField value="a"/> (text field)
<inputField value="b"/> (lookup field)
User will set a value first, maybe "company", then I would like to copy the value of a ("company") to b's text box, so that I can query b with conditon of a ("company").
Any one can help me?
Thanks
Kunlun
You don't have access to b's text value in Apex Code, only its ID, if any. You could accomplish your task using JavaScript, if you were so inclined, however.
Of course, change your values to suit, this is only for demonstration purposes. Note that you still can't access the text value of accountId in Apex Code, but if there is a reRender condition somewhere, the system would helpfully auto-fill with an ID value or a list of options if there are multiple choices.
one way solution is javascript..which is explained already another way is to use workflow to update b lookupfield...