i'm new to all this stuff and I want to know what I am doing wrong here.
I did a modal which contains some labels, inputs and a button. All the javascript code that create the modal runs in a separated file.
I am trying to trigger a java function on the click of the modal's button.
I am using NetBeans, Glassfish, JSF 2.2, Jquery and Bootsrap here come code:
<h:body>
<div class="wrapper">
<div class="well content-container vertical-center-aligned">
<h:form
...
<a id="lnkRememberPass" class="label-md col-md-6" href="#" style="text-align: right;">Remember Password</a>
<h:commandButton id="btnEmail" action="#{appFunctions.sendPasswordEmail}" rendered="#{!generalManagement.logged}"></h:commandButton>
</h:form>
</div>
</div>
</h:body>
<script type="text/javascript">
$(document).ready(function(e){
//send all the parameters to the JS file and create the modal.
$('#lnkRememberPass').modal({
'modalClass': 'modal-window ',
'shadeClass':'modal-shade',
'closeText':'Close',
'closeClass':'modal-close',
'outputClass':'',
'inputClass':'input-md form-control',
'buttonClass':'btn btn-primary btn-sm form-control sendMail', //sendMail is a class to find the button
'formClass':'form-group vertical-center-aligned modal-form'
});
$(document).find(".sendMail").click(function(ex){ //find the 'sendMail' class and trigger a click at the hidden button
try{
$("#btnEmail").trigger("click");
}catch(exception ex){
console.log(ex);
}
});
});
</script>
I don't know the right way to do all this stuff, i'm just learning =[