diff --git a/bricks/form.js b/bricks/form.js index 5ac59d0..3fa2701 100644 --- a/bricks/form.js +++ b/bricks/form.js @@ -22,22 +22,6 @@ bricks.FormBody = class extends bricks.VBox { opts.scrollY = 'scroll'; super(opts); this.name_inputs = {}; - /* - if (this.opts.title){ - var t = new bricks.Title2({ - otext:this.opts.title, - height:'auto', - i18n:true}); - this.add_widget(t); - } - if (this.opts.description){ - var d = new bricks.Text({ - otext:this.opts.description, - height:'auto', - i18n:true}); - this.add_widget(d); - } - */ this.form_body = new bricks.Layout({width:'100%', overflow:'auto' }); @@ -72,9 +56,9 @@ bricks.FormBody = class extends bricks.VBox { } return data; } - async validation(){ + async validation(form){ var data = this.getValue(); - this.dispatch('submit', data); + form.dispatch('submit', data); if (this.submit_url){ var rc = new bricks.HttpResponse(); var resp = await rc.httpcall(this.submit_url, @@ -82,14 +66,19 @@ bricks.FormBody = class extends bricks.VBox { method:this.method || 'POST', params:data }); - this.dispatch('submited', resp); + form.dispatch('submited', resp); } } build_fields(){ var fields = this.opts.fields; for (var i=0; i