Ignore:
Timestamp:
03/09/14 14:23:42 (11 years ago)
Author:
hendrikvanantwerpen
Message:
  • Enable/disable buttons on content change.
  • One place to do date formatting, because it was going wrong again.
  • Serialize questions in survey properly.
  • _ComplexValueMixin consumes submit events, but does trigger outer forms if present.
  • Trigger dialog show/hide for login only after previous effect is finished.
  • Check that documents are actually valid, not just that validator returned a result.
  • Validate email and timestamp formats.
  • Prepared for live runs.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/client/qed-client/pages/question.js

    r490 r492  
    2929        },
    3030        _handlePropertiesChange: function() {
    31             if ( this.propertiesForm.validate() ) {
    32                 lang.mixin(this.object,this.propertiesForm.get('value'));
    33             }
     31            lang.mixin(this.object,this.propertiesForm.get('value'));
    3432            this.markDirty();
     33            this._refresh();
    3534        },
    3635        _handleContentChange: function() {
    37             if ( this.contentList.validate() ) {
    38                 this.object.content = this.contentList.get('value');
    39             }
     36            this.object.content = this.contentList.get('value');
    4037            this.markDirty();
     38            this._refresh();
    4139        },
    4240        _save: function() {
    43             if ( this.propertiesForm.validate() && this.contentList.validate() ) {
    44                 lang.mixin(this.object,this.propertiesForm.get('value'));
    45                 this.object.content = this.contentList.get('value');
     41            if ( this._isValid ) {
    4642                return this.inherited(arguments);
    4743            } else {
     
    6864            return false;
    6965        },
     66        markDirty: function() {
     67            this._isValid = this.propertiesForm.validate() &&
     68                            this.contentList.validate();
     69            this.saveBtn.set('disabled',!this._isValid);
     70            this.saveAndCloseBtn.set('disabled',!this._isValid);
     71            this.discardBtn.set('label','Discard & Close');
     72            this.inherited(arguments);
     73        },
     74        markClean: function() {
     75            this._isValid = true;
     76            this.saveBtn.set('disabled',true);
     77            this.saveAndCloseBtn.set('disabled',true);
     78            this.discardBtn.set('label','Close');
     79            this.inherited(arguments);
     80        },
    7081        _ignore: function(evt) {
    7182            if ( evt ) { event.stop( evt ); }
Note: See TracChangeset for help on using the changeset viewer.