Hi guys,
I have a h:commandButton with a JavaScript check and it returns false but still runs the action. The alerts pop up false...see javascirpt below.
Any ideals
jsf-api_1_2.jar = ${maven.repo}/jsf/mojarra-1.2_09-b01-BETA1/lib/jsf-api.jar
jsf-impl_1_2.jar = ${maven.repo}/jsf/mojarra-1.2_09-b01-BETA1/lib/jsf-impl.jar
RichFaceApi_3_2.jar = ${maven.repo}/richFacesAjax/jars/richfaces_3_2_1_GA/richfaces-ui-3.2.1.GA/lib/richfaces-api-3.2.1.GA.jar
RichFaceImpl_3_2.jar = ${maven.repo}/richFacesAjax/jars/richfaces_3_2_1_GA/richfaces-ui-3.2.1.GA/lib/richfaces-impl-3.2.1.GA.jar
RichFaceUi_3_2.jar = ${maven.repo}/richFacesAjax/jars/richfaces_3_2_1_GA/richfaces-ui-3.2.1.GA/lib/richfaces-ui-3.2.1.GA.jar
Thanks for any help
Phil
<td height="75">
<font color="black" size="2"><h:outputText styleClass="bold2" value="Cancel My Account" /></font>
<div>
<h:selectOneRadio id="memberCancel" required="false" value="#{bean.ACTIVE_FLAG}">
<f:selectItem itemLabel="Save Account" itemValue="Y"/>
<f:selectItem itemLabel="Cancel Account" itemValue="N"/>
</h:selectOneRadio>
</div>
</td>
=========================================
<h:commandButton id="CancelAccountID" type="submit"
onclick="checkCancel()"
action="#{updateMember.saveAcctCancel2Oracle}"
value = "Update Account" >
</h:commandButton>
=============================================
< script type="text/javascript" >
function checkCancel(){
if(document.forms[0].elements["f1:memberCancel"][1].checked == true){
alert("**** Warning this cancel is Permanent **** " );
if(window.confirm('Are you sure you want to cancel membership ? ') )
{
alert("**** True **** " );
return true;
}else{
alert("**** false **** " );
return false;
}
} else {
return false;
}
}
</script>