function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Update a text field onclick

I want to insert "yes" into a text field {!Referral__c.Viewed__c} when a user clicks an outputLink.  How do I do that?


Thank you in advance!

Rahul SharmaRahul Sharma

If you are doing this in visualforce page and in case if you don't have any controller for the page define one.
- Use apex:commandLink tag in visualforce page.

- Create method in controller or extension, and use that as Action in apex:commandLink for performing action.


You can display two types of link in visualforce:

- apex:outputLink: A link just for redirection to a URL behaves same as HTML anchor tag.

- command link: A link used for performing some action.


Your requirement was still not clear so i tried my best to answer this.

Hope it helps.