Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TC.Dialog = CQ.Ext.extend(CQ.Dialog, {
- ok: function(button, success, failure) {
- var config = {};
- var rsSuccess;
- var rsFailure;
- if (this.responseScope) {
- config.scope = this.responseScope;
- rsSuccess = this.responseScope.success;
- rsFailure = this.responseScope.failure;
- }
- config.success = success ? success : this.success ? this.success : rsSuccess;
- config.failure = failure ? failure : this.failure ? this.failure : rsFailure;
- if (this.form.isValid()) {
- if (this.fireEvent("beforesubmit", this) === false){
- return false;
- }
- this.form.items.each(function(field) {
- // clear fields with emptyText so emptyText is not submitted
- if (field.emptyText && field.el && field.el.dom && field.el.dom.value == field.emptyText) {
- field.setRawValue("");
- }
- });
- var action = new CQ.form.SlingSubmitAction(this.form, config);
- this.form.doAction(action);
- this[this.closeAction]();
- } else {
- CQ.Ext.Msg.show({
- title:CQ.I18n.getMessage('Failed'),
- msg: CQ.I18n.getMessage('Custom validations'),
- buttons: CQ.Ext.Msg.OK,
- icon: CQ.Ext.Msg.ERROR
- });
- }
- }
- });
- // register xtype
- CQ.Ext.reg('tcdialog',TC.Dialog);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement