I have the following HTML Form displayed, and I would like to call the javascript function sendMail() when the user clicks on the Send button:
<script type="text/template" id="compose-view-template">
<form id="email-compose" class="form-email-compose" method="get" action="javascript:sendMail();">
<div class="form-group">
<input type="email" id="input-to" placeholder="To" class="input-transparent form-control"
value="<%= receiver %>">
</div>
<div class="form-group">
<input type="text" id="input-subject" placeholder="Subject" class="input-transparent form-control"
value="<%= subject %>">
</div>
<div class="form-group">
<textarea rows="10" class="form-control" id="wysiwyg" placeholder="Message"><%- body %></textarea>
</div>
<div class="clearfix">
<div class="btn-toolbar pull-xs-right">
<button type="reset" id="compose-discard-button" class="btn btn-gray">Cancel</button>
<button type="submit" id="compose-send-button" onclick="" class="btn btn-danger"> Send </button>
</div>
</div>
</form>
and the Javascript function:
function sendMail(){
console.log("submit new email");
}
</script>
but when I click on Send, I have the following error
Form submission canceled because the form is not connected
even if I mention an action to the form or to the button onclick I still have the same error. anybody knows how I can solve this issue ?