Once a lookup field is populated and I open the same visualforce page later then the lookup field is prepopulated.
I want to put ‘X’ next to Lookup field so that when ‘X’ is clicked, the field value gets cleared.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do this with a simple bit of javascript which sets the value of the field to blank, there’s just a bit of Force.com magic regarding obtaining the ID of the element to use. Below is a complete page which does what you need.
Note that the recommended way of applying javascript to a link is to do it on page load, though you may find it simpler to do the above since it saves you having to drill down to the element
{!$Component.Parent.Child.Grandchild}(which is needed when using<apex:pageBlock>etc.) and if javascript isn’t enabled, your user will have bigger problems than your link not working!