This discussion is archived
1 Reply Latest reply: Feb 7, 2013 11:27 PM by Kayaman RSS

Not able to call javascript function from JSF/ADF ...

866438 Newbie
Currently Being Moderated
Hello Friends,
I am new to JSF AND JAVASCRIPT. Below is snipet of code i am trying to exceute but it not giving expected result.


<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:trh="http://myfaces.apache.org/trinidad/html"
xmlns:tr="http://myfaces.apache.org/trinidad">


<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<!-- javascript-->
<trh:script id="script">
function hideDiv() {
document.getElementById('divID').style.display='none';
}
function showDiv() {
document.getElementById('divID').style.display='block';
}
</trh:script>
<!-- javascript ends-->
<af:document id="d1">
<af:form id="f1">
<!-- javascript funtion call from onclick -->
<tr:selectBooleanRadio text="selectBooleanRadio 1" label="Label 1"
id="sbr1" onclick="showDiv()"/>

<!-- simple output if radio button is clicked-->
<div class="divID">
<textarea name="hello" cols="2" rows="2"></textarea>
</div>
<!-- simple output if radio button is not clicked-->
</af:form>
</af:document>
</f:view>
</jsp:root>

problems here:

1) Radio button is not clickable(Not able to click radio button)
2) It is not calling a JAVASCRIPT function showDiv() from onclick="showDiv()"

Please help me to find the problem area.

Thanks for your help well in advance,

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points