Advertisement
Guest User

Untitled

a guest
Jul 29th, 2014
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. TC.Dialog = CQ.Ext.extend(CQ.Dialog, {
  2.  
  3. ok: function(button, success, failure) {
  4. var config = {};
  5. var rsSuccess;
  6. var rsFailure;
  7. if (this.responseScope) {
  8. config.scope = this.responseScope;
  9. rsSuccess = this.responseScope.success;
  10. rsFailure = this.responseScope.failure;
  11. }
  12. config.success = success ? success : this.success ? this.success : rsSuccess;
  13. config.failure = failure ? failure : this.failure ? this.failure : rsFailure;
  14.  
  15. if (this.form.isValid()) {
  16. if (this.fireEvent("beforesubmit", this) === false){
  17. return false;
  18. }
  19. this.form.items.each(function(field) {
  20. // clear fields with emptyText so emptyText is not submitted
  21. if (field.emptyText && field.el && field.el.dom && field.el.dom.value == field.emptyText) {
  22. field.setRawValue("");
  23. }
  24. });
  25. var action = new CQ.form.SlingSubmitAction(this.form, config);
  26. this.form.doAction(action);
  27. this[this.closeAction]();
  28. } else {
  29. CQ.Ext.Msg.show({
  30. title:CQ.I18n.getMessage('Failed'),
  31. msg: CQ.I18n.getMessage('Custom validations'),
  32. buttons: CQ.Ext.Msg.OK,
  33. icon: CQ.Ext.Msg.ERROR
  34. });
  35. }
  36. }
  37.  
  38.  
  39. });
  40.  
  41. // register xtype
  42. CQ.Ext.reg('tcdialog',TC.Dialog);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement