Hi,
I have to show/hide a adfcore input elements dynamically using javascript.
i tried like this.
<afh:head title="UpdateLawFirm">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<afh:script text="
function doWork() {
var e=document.getElementById('updatefrm:branch');
var d=document.getElementById('updatefrm:testid');
var f=e.selectedIndex;
if(f==1){
d.value='';
d.disabled='true';
} else if(f==2){
d.disabled='';
}
} "/>
</afh:head>
<h:form id="updatefrm">
<af:selectOneChoice id="branch" autoSubmit="false"
unselectedLabel="Select" onchange="doWork()" required="true" requiredMessageDetail="Branch selection is required"> <f:selectItem itemLabel="Branch1" itemValue="b1"/> <f:selectItem itemLabel="Branch2" itemValue="b2"/> </af:selectOneChoice>
<af:inputText columns="20" id="testid'" value =""/>
Here it is diabling correctly when i select branch1 as a first attempt. but when i am selecting branch2 it is not enabling again.
The above logic is not working. Frank i tried your blog code too. But it is not working.. could anyone help me regarding this.
Thanks,
Arun