2

I've just spent the better part of my day trying to sort this out. Seems that if i have a Currency type in my custom object (mortgages__c), there is no way to get the Page to gather input and reflect it back into my custom object IF I HAVE A RENDERED ATTRIBUTE ON IT. E.g:

< apex:pageBlockSectionItem > 
  < apex:outputLabel value="Total Liens $"  rendered="{!isRealAsset}"/ >
  < apex:inputField value="{!obj.mortgages__c}" rendered="{!isRealAsset}"/ >
< /apex:pageBlockSectionItem > 

Where my record of custom object is "obj" with a field mortgages__c and isRealAsset() is a Boolean method that returns a true or false.

I've tried to put the render on the pageBlockSectionItem. I've tried to wrap it all in an outputPanel with a rendered attribute. I've tried a bunch of different things and the ONLY thing that works is to have rendered="true". (Not very useful!) That is the only way the value will be reflected back in my object.

Can anyone tell me what is going on? Super annoyed so i hope i'm just doing something careless. Any ideas?

Thank you!

2
  • Do you want these fields to be visible only on some condition ? Rendered will only make them visible/invisible.
    – Dave
    May 25, 2015 at 1:26
  • I am not able to understand the reason for using rendered in your case. Could you clarify?
    – Dave
    May 25, 2015 at 1:33

1 Answer 1

1

Out of left field, is the isRealAsset() called getIsRealAsset() in the controller? I seem to recall seeing something weird before where using is to start a method compiles but doesn't work in practice.

If the method is just called isRealAsset then try renaming it to getIsRealAsset, I suspect it'll start working!

5
  • Dave-Yes, i need to have the label and field visible only when "isRealAssest()" returns true. I'll try renaming it to getIsRealAsset() and see what happens.
    – Cindy
    May 25, 2015 at 3:56
  • It looks like it didn't help to rename "isRealAsset()" to getisRealAsset() or anything else. That would have been nice. Its a simple function checking a String value and returning true or false (but changed it to "assetIsReal()" just in case): public Boolean assetIsReal { get{if (assetTypeChosen == 'ASSET-REAL') return true; return false;} set;}
    – Cindy
    May 25, 2015 at 4:10
  • So which way is it going? Always rendering the field or always not rendering it? Or does it switch but doesn't let you gather input
    – Matt Lacey
    May 25, 2015 at 6:36
  • So which way is it going - does it always render or not? Or, is it that it is rendering but you can't get the input from it when using the rendered attribute?
    – Matt Lacey
    May 25, 2015 at 6:36
  • The rendering part works absolutely fine but, oddly enough, if i have any kind of "Rendered" attribute on the inputField (even if i put the rendered on the pageBlockSectionItem or enclose all of them in an outputPanel), the mortgages__c will not reflect the new value. One caveat, if i simply put rendered="true" (rather than any conditional), the value IS reflected in mortgages__c.
    – Cindy
    May 25, 2015 at 14:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .