Sha256: c767306fbbbff0ce0f89632523fc290d55c01dbf0010102e5074a8477e4e1352
Contents?: true
Size: 1.46 KB
Versions: 3
Compression:
Stored size: 1.46 KB
Contents
/* --- script: Submittable.js description: Makes widget result in either submission or cancellation license: Public domain (http://unlicense.org). authors: Yaroslaff Fedin requires: - LSD.Mixin provides: - LSD.Mixin.Submittable ... */ LSD.Mixin.Submittable = new Class({ options: { actions: { autosubmission: { enable: function() { if (this.attributes.autosubmit) this.submit(); } } }, events: { _form: { attach: function(element) { if (LSD.toLowerCase(element.tagName) == 'form') element.addEvent('submit', this.bindEvent('submit')); }, detach: function(element) { if (LSD.toLowerCase(element.tagName) == 'form') element.removeEvent('submit', this.bindEvent('submit')); } } } }, submit: function(event) { if (event && event.type == 'submit' && event.target == this.element) event.preventDefault(); var submission = this.captureEvent('submit', arguments); if (submission) return submission; else if (submission !== false) this.callChain(); return this; }, cancel: function() { var submission = this.captureEvent('cancel', arguments); if (submission) return submission; else if (submission !== false) { var target = this.getSubmissionTarget(); if (target) target.uncallChain(); this.uncallChain(); }; return this; } }); LSD.Behavior.define(':submittable', LSD.Mixin.Submittable);
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lsd_rails-0.1.2 | Packages/lsd/Source/Mixin/Submittable.js |
lsd_rails-0.1.1 | Packages/lsd/Source/Mixin/Submittable.js |
lsd_rails-0.1 | Packages/lsd/Source/Mixin/Submittable.js |