Requires

Provides

Form.Request.Append.js

Handles the basic functionality of submitting a form and updating a dom element with the result. The result is appended to the DOM element instead of replacing its contents.

License:
MIT-style license
Authors:
Aaron Newton
  1. 26
  2. 27
  3. 28
  4. 29
  5. 30
Form.Request.Append = new Class({ Extends: Form.Request, options: {

onBeforeEffect: function(){},

  1. 32
  2. 33
  3. 34
  4. 35
  5. 36
  6. 37
  7. 38
  8. 39
  9. 40
  10. 41
  11. 42
  12. 43
  13. 44
  14. 45
  15. 46
  16. 47
  17. 48
  18. 49
  19. 50
  20. 51
  21. 52
  22. 53
  23. 54
  24. 55
  25. 56
  26. 57
  27. 58
  28. 59
  29. 60
  30. 61
  31. 62
  32. 63
  33. 64
  34. 65
  35. 66
  36. 67
  37. 68
  38. 69
  39. 70
  40. 71
  41. 72
  42. 73
  43. 74
  44. 75
  45. 76
  46. 77
useReveal: true, revealOptions: {}, inject: 'bottom' }, makeRequest: function(){ this.request = new Request.HTML(Object.merge({ url: this.element.get('action'), method: this.element.get('method') || 'post', spinnerTarget: this.element }, this.options.requestOptions, { evalScripts: false }) ).addEvents({ success: function(tree, elements, html, javascript){ var container; var kids = Elements.from(html); if (kids.length == 1){ container = kids[0]; } else { container = new Element('div', { styles: { display: 'none' } }).adopt(kids); } container.inject(this.update, this.options.inject); if (this.options.requestOptions.evalScripts) Browser.exec(javascript); this.fireEvent('beforeEffect', container); var finish = function(){ this.fireEvent('success', [container, this.update, tree, elements, html, javascript]); }.bind(this); if (this.options.useReveal){ container.get('reveal', this.options.revealOptions).chain(finish); container.reveal(); } else { finish(); } }.bind(this), failure: function(xhr){ this.fireEvent('failure', xhr); }.bind(this) }); } });