Monday 10 March 2014

Spell checking in input text field

This blog we will see how to check the spelling in input text box in ADF.

In real life scenario, sometimes it is required to check the spelling while user is entering the text.The below code is required to check the spelling inside the input text box.

<af:resource type="javascript">
    function checkSpell(event) {
       event.getSource().getPeer().getDomElement().setAttribute('spellcheck','true');
    }
</af:resource>
<af:form id="f1" binding="#{backingBeanScope.backing_BeanJavaScript.f1}">
    <af:inputText label="Enter your text : " id="it1">
         <af:clientListener method="checkSpell" type="focus"/>
    </af:inputText>
</af:form>

Thanks...

Sunday 9 March 2014

Call JavaScript from bean in ADF page

This blog we will see how to call java script from bean in ADF page.

In real life scenario, sometimes it is required to use JavaScript from backing bean. The below code is the call JavaScript from bean in ADF page.

FacesContext facesContext = FacesContext.getCurrentInstance();
org.apache.myfaces.trinidad.render.ExtendedRenderKitService service = org.apache.myfaces.trinidad.util.Service.getRenderKitService(facesContext, ExtendedRenderKitService.class);

service.addScript(facesContext, "alert('Hello!!!');window.close();");

Thanks...