0
votes

In my Salesforce record, I have an object that has a picklist called "Type" with 3 options: Alpha, Beta, Charlie. In a custom Visualforce page, I want to have:

Alpha Sample Text Sample Text Sample Text Sample Text ALPHA button/link

Beta Sample Text Sample Text Sample Text Sample Text BETA button/link

Charlie Sample Text Sample Text Sample Text Sample Text CHARLIE button/link

where each of the "button/link" sections is a separate HTML button or can be an anchor link. Is there a way so that if I click on one of these buttons/links I can have it update (quicksave) "Type" with the corresponding value?

Note: At the top of the page I have an apex:inputField tag for the picklist and a "quicksave" button already. I just want to also be able to update it with these potential buttons/links.

The only way I can think of to do it is to use JavaScript to simulate picking an option from the generated dropdown list and simulating a buttonclick of "quicksave" which seems rather gimmicky.

1

1 Answers

0
votes

You could use an apex:commandLink or apex:commandButton to set the value on the controller.

As for updating the picklist you have a few options.

  1. You could add an apex:actionSupport tag that would grab the buttons value on click and rerender the picklist.
  2. If you're already using jquery on the page you could update the select dropdown onClick of the button