I have the following commandLink
<apex:commandLink value="Save" onClick="Validation();" action="{!ActionMethod}" />
When it's clicked, I would like to stop the action from executing by returning false.
function Validation() {
return false;
}
The above method does not work, but if I put return false directly in the onClick attribute the behaviour works as expected:
<apex:commandLink value="Save" onClick="return false;" action="{!ActionMethod}" />
Is there a way I can pass this return value up to the onClick attr?
Gist Edit
<apex:commandLink value="Save" onclick="return Validation();" action="{!saveSettings}"/>
function Validation() {
alert('returning false');
return false;
}
// Alert shows 'returning false', action still executes.