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
BenzyBenzy 

Error when saving VF page: Unsupported attribute action in <apex:outputLink>

Hi,
I'm trying to pass a picklist value into a url, whcih then links to a report which is filtered based on that value. However, I'm getting an error when trying to save the VF page, which says Error: Unsupported attribute action in <apex:outputLink> in Special_Reports at line 10 column 75

VF Page Code:

<apex:page controller="dynamicpicklist" >
    <apex:form >
    <apex:sectionHeader title="Dynamic Picklist" subtitle="Reusable code"/>
        <apex:pageblock >
            <apex:pageBlockSection title="Dynamic picklist" columns="1">
                <apex:outputlabel value="Pollinator" for="values" />
                <apex:selectList value="{!pollinator}" size="1" id="values">
                    <apex:selectOptions value="{!pollinatornames}"/>
                </apex:selectList>
                <apex:outputLink id="link" action="{!processLinkClick}">Process Report</apex:outputLink>                                          
            </apex:pageblocksection>
        </apex:pageblock>
    </apex:form>
</apex:page>

Class:

public class dynamicpicklist
{
    public String pollinator{get; set;}

    public List<SelectOption> getpollinatornames()
        {
          List<SelectOption> options = new List<SelectOption>();
          List<User> pollinatorlist = new List<User>();
          pollinatorlist = [Select Id, Name FROM User ];
          options.add(new SelectOption('--None--','--None--'));
          for (User users : [SELECT Id, Name FROM User WHERE Profile.Name = 'Pollinators' AND IsActive = TRUE ORDER BY Name ASC])
              {
                  options.add(new selectOption(users.Id, users.Name));
              }
      return options;
        }
    public string pollinatorurl{get;set;}
        public PageReference processLinkClick() {
        return new PageReference('/00O90000005uwmQ?pv1='+pollinatorurl);
    }
}
Coco_SdyneyCoco_Sdyney
action="{!processLinkClick}"
this is not a supportted attribute of outputlink, please use onclick to call javascript method.


BenzyBenzy
Ok thanks

I'm having a lot of trouble with this. Can you provide an example of the how the link and class would look for this?

Thanks
Coco_SdyneyCoco_Sdyney
<apex:outputLink id="link" onclick="processLinkClick()">Process Report</apex:outputLink>

<script>
function processLinkClick()
  {
  window.location="/00O90000005uwmQ?pv1="+"{!pollinatorurl}";
  }
</script>