문제

I want to know if I can change Apex VisualForce tag attributes from the controller.

Can i do something like this?:

tag:

 <apex:selectList id="Status" value="blah blah" multiselect="false" size="1">

in the controller:

if (inc.Status__c == 'Closed'){
    Status.Rendered = false
}

Hope that makes sense!

I am current doing this, which i think is a bit long winded and want to avoid:

tag

 <apex:selectList id="Status" value="blah blah" rendered="{!IncidentIsClosed}">

in the controller

   if (inc.Status__c == 'Closed'){
    IncidentIsClosed = false;
    }

    ....

    public Boolean getIncidentIsClosed() {
            return IncidentIsClosed;
        }

hope that helps!

도움이 되었습니까?

해결책

Syntax for merge fields (stuff in {!...} brackets) is same as for validation rules, formula fields, workflow triggering conditions etc. So you can use functions like TODAY() as well as some more complex logic.

So I think that if "inc" object is visible on your page then something like

...rendered="{!not(inc.Status='Closed')}

should do the trick. If you use standard controller then replace "inc" with sObject name (like "Case").

다른 팁

I came to Visualforce from a .NET environment where you could change the page from the controller (or by that means to create parts of the page from the controller), so I understand your question...

Unfortunately, you can't do the same in Visualforce.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top