Commit f0d8d3a0 authored by Rafael Ostertag's avatar Rafael Ostertag
Browse files

Added new events to Form: `form.validation.(before|after)`

parent abbb3bb0
......@@ -116,12 +116,17 @@ var QfqNS = QfqNS || {};
* @returns {*}
*/
n.Form.prototype.validate = function () {
this.eventEmitter.emitEvent('form.validation.before', n.EventEmitter.makePayload(this, null));
// uncommented because bootstrap-validator sets novalidate="true" on form.
//if (this.$form.attr('novalidate')) {
// return true;
//}
return document.forms[this.formId].checkValidity();
var result = document.forms[this.formId].checkValidity();
this.eventEmitter.emitEvent('form.validation.after', n.EventEmitter.makePayload(this, {validationResult: result}));
return result;
};
/**
......
......@@ -90,6 +90,7 @@ var QfqNS = QfqNS || {};
//n.Helper.jqxEditor();
n.Helper.tinyMce();
this.form.on('form.submit.before', n.Helper.tinyMce.prepareSave);
this.form.on('form.validation.before', n.Helper.tinyMce.prepareSave);
};
n.QfqForm.prototype.on = n.EventEmitter.onMixin;
......
......@@ -343,8 +343,8 @@
<label for="notes-editor" class="control-label">Notes</label>
</div>
<div class="col-md-6">
<textarea id="notes-editor" class="jqw-editor"
data-control-name="notesField" name="notesField">
<textarea id="notes-editor" class="qfq-tinymce"
data-control-name="notesField" name="notesField" required>
</textarea>
</div>
......@@ -836,7 +836,7 @@
</div>
</form>
<a href="www.google.ch">away</a>
<a href="https://www.google.ch">away</a>
</div>
<script type="application/jqw-combobox-source" id="combobox1_source">
......@@ -853,6 +853,7 @@
<script src="../js/validator.min.js"></script>
<script src="../js/jqx-all.js"></script>
<script src="../js/globalize.js"></script>
<script src="../js/tinymce.min.js"></script>
<script src="../js/EventEmitter.min.js"></script>
<script src="../js/qfq.debug.js"></script>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment