Discovered while debugging another developer's code ... sigh
Given a controller defined with a single getter/setter
public with sharing class SfseCtrlExample {
public String foo {get; set;}
public void doAction() {}
}
Given a VF page using a commandButton and commandLink that passes a parameter to existing (foo) and non-existing (bar) controller properties
<apex:page id="SfseCtrlExample" controller="SfseCtrlExample">
<apex:form id="theForm">
<apex:outputText value="foo paramVal={!foo}"/>
<br/>
<apex:commandButton value="Do Action" action="{!doAction}" reRender="theForm">
<apex:param name="p1f" assignTo="{!foo}" value="fooValCB"/>
<apex:param name="p1b" assignTo="{!bar}" value="barValCB"/>
</apex:commandButton>
<br/>
<apex:commandLink value="Do Action (CL)" action="{!doAction}" reRender="theForm">
<apex:param name="p2f" assignTo="{!foo}" value="fooValCL"/>
<apex:param name="p2b" assignTo="{!bar}" value="barValCL"/>
</apex:commandLink>
</apex:form>
</apex:page>
When either commandButton or commandLink clicked
- The
assignTo="{!foo}"
successfully passes the value to the controller (for commandButton, requires the well-known reRender workaround)
But no compile-time or run-time error results for the
assignTo="{!bar}"
I can sort of see why there's no error for apex:param
nested under apex:commandButton
as that is not supported, but given that the VF page compiler can check for missing properties and methods in other components, why is it not for apex:param
?
I have followed up my internal team for your concern and will notify you as soon as I have an update from them.
- I just want SFDC to ack this as a doc errorWe further escalated this case to R&D team
-- ooh!