subform_field.js 859 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //iTop Subform field
  2. ;
  3. $(function()
  4. {
  5. // the widget definition, where 'itop' is the namespace,
  6. // 'subform_field' the widget name
  7. $.widget( 'itop.subform_field', $.itop.form_field,
  8. {
  9. // default options
  10. options:
  11. {
  12. field_set: null
  13. },
  14. // the constructor
  15. _create: function()
  16. {
  17. var me = this;
  18. this.element
  19. .addClass('subform_field');
  20. this._super();
  21. },
  22. // events bound via _bind are removed automatically
  23. // revert other modifications here
  24. _destroy: function()
  25. {
  26. this.element
  27. .removeClass('subform_field');
  28. this._super();
  29. },
  30. getCurrentValue: function()
  31. {
  32. return this.options.field_set.triggerHandler('get_current_values');
  33. },
  34. validate: function(oEvent, oData)
  35. {
  36. return {
  37. is_valid: this.options.field_set.triggerHandler('validate', oData),
  38. error_messages: []
  39. }
  40. },
  41. });
  42. });