0

Today I was looking at a code that was exiting in the org from a long time and I was surprised to find that the the value assigned in the assignTo attribute in the apex:param tag doesn't exit in the controller. But below is the description for the assignTo attribute:

A setter method that assigns the value of this param to a variable in the associated Visualforce controller. If this attribute is used, getter and setter methods, or a property with get and set values, must be defined.

As you can see from the below code, I have not used any controller / extensions in the page, but still I can still use a variable someVariable in the assignTo attribute. The page compiles and renders fine. Looks like a bug to me. Any idea?

<apex:page>
    <apex:form>
        <apex:commandButton value="Do Something">
            <apex:param assignTo="{!someVariable}" value="clicked"/>
        </apex:commandButton>
    </apex:form>
</apex:page>
4
  • Can you mention someVariable? i mean is it like {!Account.Name}
    – snehakem
    Commented Jan 16, 2015 at 8:42
  • 1
    @snehakem: My intention was that the compiler should never have saved this page in the first place as the sameVariable doesn't exit. There's no standardController defined in the page, so it can't be {Account.Name}
    – Sam
    Commented Jan 16, 2015 at 8:52
  • Does it still compile if you have a name attribute? apex:param without a name doesn't do anything.
    – Dominic
    Commented Jan 16, 2015 at 9:00
  • Yes it does compile after adding the name attribute
    – Sam
    Commented Jan 16, 2015 at 9:05

0

You must log in to answer this question.

Browse other questions tagged .