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){


<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}" />

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}"/>

Code of MIRPriorityDetailController

    update sobj;    
    mirObj.abletoUpdatePriority = 'sucess';     
catch(DMLException excp){
    mirObj.abletoUpdatePriority = 'fail';            
  • So VF page A using controller Foo includes a component Bar that does DML in its own controller MIRPriorityDetailController and based on the success of the DML, you want to communicate this success state back to controller A ? – cropredy Dec 27 '13 at 19:56

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:

Boolean result1 = 'false';
if(valueOf(mirObj.abletoUpdatePriority) = 'sucess') result1 = 'true';
else if(valueOf(mirObj.abletoUpdatePriority) = 'fail') result1 = 'false';

Depending on the logic in the rest of your controller, you may need to do the opposite like below:

if(result1 == 'true') mirObj.abletoUpdatePriority = 'sucess';
else if(result1 == 'false') mirObj.abletoUpdatePriority = 'fail';

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.