5 Replies Latest reply on Jul 22, 2013 1:49 PM by Arunkumar Ramamoorthy-Oracle

    Issue with invoking javascript during jspx page load


      Hi All,


      I am using Jdeveloper 11gR2.


      I have embedded a small javascript snippet in the adf page to invoke a managed bean method during page load.


      <af:serverListener type="onloadEvent" method="#{AMBean.click}"/>

                  <af:clientListener method="onLoadClient" type="load"/>

                  <af:resource type="javascript">function onLoadClient(event) {AdfCustomEvent.queue(event.getSource(),"onloadEvent",{},false); return true;}</af:resource>



      In the associated managed bean method, I want to change the setContentStyle of all the input text field found during run time -


              System.out.println("There control is inside the listeners");

              FacesContext facesContext = FacesContext.getCurrentInstance();


              UIViewRoot root = facesContext.getViewRoot();

              System.out.println("root - " +root);

              RichPanelFormLayout formClass = (RichPanelFormLayout)root.findComponent("db");

              System.out.println("formClass - " + formClass);

              List<UIComponent> uiComponentList = formClass.getChildren();

                    for (UIComponent uiComponent : uiComponentList) {

                        if (uiComponent instanceof RichInputText) {




                            System.out.println("uiComponent - " +uiComponent);




      Currently the javascript function "queues" the setContentStyle action for an action event, i.e. during the initial page load, the properties of text fields are not changed, however as soon as i click any button on the page, the text field width is reset to what I have defined in setContentStyle property.


      Is there a way to execute setContentStyle action as soon as the page loads initially?


      Best Regards,

      Ankit Gupta