0

I've created rerenderer function to hide the field after component is loaded but it still doesn't work as expected.

Note: I've not added slds-hide or slds-show class in component. Just trying to hide using js when component is loaded.

rerender : function(component, helper) {

    this.superAfterRender();
    if(component.get("v.Value") === 'No'){
        $A.util.addClass(component.find("FieldToHide"),"slds-hide");
    }       
}
0

I dont know your exact use case but here are few things that you can do, first use the below event 'render'

<aura:handler name="render" value="{!this}" action="{!c.onRender}"/>

There seems to be something wrong in this line below we do a component.find of an aura id and then do v.value not sure if this line is returning anything.

//if(component.find("FieldTovalidate").get("v.value") === 'No')     
if(component.get("v.Value") === 'No'){

you can put a try catch around this and log an error in browser console to see if this is erroring out

  • Thanks @RedDevil. I tried but it's not going to catch block. I've followed solution posted here (The same use case): salesforce.stackexchange.com/questions/158237/… – anonymous Apr 24 at 13:49
  • You need to use component.find of an aura id in render event helper function and then check the no condition. added it to my answer above. – RedDevil Apr 24 at 13:53

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.