I want to pass a boolean parameter from component to VF page, so that I can control the flow depending on the value of this parameter.
I am not getting updated value of boolean parameter on VF page. I am setting this value in a controller of a component. I am getting blank string always.
Code of Page.
function resetPriorityAction(abletoUpdatePriority){
alert(abletoUpdatePriority);
....
}
**snip**
<div class="verticalContent priorities">
<apex:repeat value="{!MIR.prioritiesWithAF}" var="priority">
<div class="verticalContentItem priority {!priority.record.Id}">
<c:MIRPriorityDetails p="{!priority}" showExtra="{!MIR.hasMainSA}" hidebut="{!isedit}" mir="{!MIR}" />
</div>
</apex:repeat>
Code of Component.
<apex:component controller="MIRPriorityDetailController" allowDML="true">
<apex:attribute name="mir" type="MIRObject" description="MIRObject" assignTo="{!mirObj}"/>
<apex:actionFunction name="savepriorityDetail" action="{!SavePriority}" rerender="priority" oncomplete="resetPriorityAction({!mirObj.abletoUpdatePriority});">
<apex:param value="aoe" name="aoe" assignTo="{!areasOfExpertise}"/>
</apex:actionFunction>
Code of MIRPriorityDetailController
try{
update sobj;
mirObj.abletoUpdatePriority = 'sucess';
}
catch(DMLException excp){
mirObj.abletoUpdatePriority = 'fail';
}
Best Answer
You don't show your declaration of the boolean object in your controller. That would be very helpful.
A Boolean will have a value of either 'true' or 'false'. To work around that issue, you likely need to do something along the lines of the following:
Depending on the logic in the rest of your controller, you may need to do the opposite like below:
Without seeing the rest of your controller, I really couldn't say. I hope this at least points you in the correct direction toward solving your issue.