Improving formItem mixin and form dialog component behavior

This commit is contained in:
Bruno Alves de Faria committed 2017-07-14 07:37:14 -03:00
1 parent 4315f47b61
commit fddf486064
5 files changed
+46 -18

No files matched your search

@@ -41,7 +41,7 @@ OHIF.mixins.formItem = new OHIF.Mixin({
// returning `undefined` and breaking the app
Meteor.defer(() => {
component.$element.val(value).trigger('change');
})
});
};
// Disable or enable the component
@@ -221,6 +221,17 @@ OHIF.mixins.formItem = new OHIF.Mixin({
return component.changeObserver.depend();
};
// Click the first submit (or first button if submit not found) button on closest form
component.triggerFormMainButton = () => {
const $form = component.$element.closest('form');
let $formButton = $form.find('button[type=submit]:first');
if (!$formButton.length) {
$formButton = $form.find('button:first');
}
$formButton.click();
};
},
onRendered() {
@@ -4,6 +4,7 @@
class="{{this.class}}"
disabled="{{#if this.disabled}}disabled{{/if}}"
title="{{this.title}}"
type="{{this.type}}"
{{this.tagAttributes}}
>
{{>UI.contentBlock}}