function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Is it possible to call javascript function from "Rendered" attribute

Hello All,


Is it possible to call javascript function from "Rendered" attribute of pageblock section item..










Ron HessRon Hess

no place to specify your call , but it sounds like you are looking for onrendered="JSCODE"


i think you can just put a script block inside your panel that will be rendered, that should allow your code to run after the page rerenders that section.


Thanks Ron for your reply.


I am looking for solution like I have two drop down list  "Visa Status"  which has two values Yes & No

I f will select Yes then Visa Type drop down list should be rendered  & populate just below  the Visa status drop down list .

And if I will select NO then Visa Type drop down should not be rendere.



Please suggest me the better  approch ..









I think you could do this

<apex:outputPanel rendered="{!showStatesList=true}">
                                                            <apex:selectList value="{!states}" multiselect="false"
                                                                size="1" styleClass="list_box" style="width: 195px;" >
                                                                <apex:selectOptions value="{!statesList}"
                                                                    id="states1" />
                                                        <apex:outputPanel rendered="{!showStatesList=false}">
                                                            <apex:inputText value="{!company.StateName__c}" styleClass="txt_box"
                                                            maxlength="30" onblur="this.value=this.value.trim()"/>