Finding component in region by javascript in adf

Quick Tip – If you are search component in region by javascript then follow code below

var region = AdfPage.PAGE.findComponentByAbsoluteId("regionId");
if(region != null){
  var comp = region.findComponent("ID");
} 

or

var comp = AdfPage.PAGE.findComponentByAbsoluteId("regionId:ID"); 

And if you are searching component through java then follow this blog entry by Edwin

Happy learning with Vinay

find ADF Faces Components in Page by javascript-findComponent

When we using JavaScript with ADF, the AdfPage.PAGE.findComponentByAbsoluteId() and AdfPage.PAGE.findComponent() are useful.

-> Search by the component ID – use findComponentByAbsoluteId function
-> Search in component that stamps its children – use findComponentByAbsoluteLocator function Relative Search
-> Use findComponent function. This function searches the component clientId which can be renderer implementation specific.

you can write a java script function like

    <af:resource type="javascript">
          function contactsPopupOpenListener(evnt) { var contactBtn =
          AdfPage.PAGE.findComponent("T:topMenuLink_contact");
          contactBtn.setStyleClass("OCCTopMenuContactLinkActive"); } function
          contactsPopupCloseListener(evnt) { var contactBtn =
          AdfPage.PAGE.findComponent("T:topMenuLink_contact");
          contactBtn.setStyleClass("OCCTopMenuContactLink"); }
        </af:resource>

happy finding of component with Vinay in Techartifact…. 🙂