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>
sameVariable
doesn't exit. There's no standardController defined in the page, so it can't be{Account.Name}
name
attribute?apex:param
without aname
doesn't do anything.name
attribute