From f5297f17a78d901a8e66e49f23339481937c7ef5 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 23 Apr 2014 16:44:01 +0000 Subject: [PATCH] Add a get_value() function to allow access to values outside of callback --- etemplate/js/et2_widget_dialog.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/etemplate/js/et2_widget_dialog.js b/etemplate/js/et2_widget_dialog.js index 902fedd056..02d7326b62 100644 --- a/etemplate/js/et2_widget_dialog.js +++ b/etemplate/js/et2_widget_dialog.js @@ -260,17 +260,25 @@ var et2_dialog = et2_widget.extend({ * @param button_id integer The ID of the clicked button */ click: function(target, button_id) { + if(this.options.callback) + { + this.options.callback.call(this,button_id,this.get_value()); + } + // Triggers destroy too + this.div.dialog("close"); + }, + + /** + * Returns the values of any widgets in the dialog. This does not include + * the buttons, which are only supplied for the callback. + */ + get_value: function() { var value = this.options.value; if(this.template) { value = this.template.getValues(this.template.widgetContainer); } - if(this.options.callback) - { - this.options.callback.call(this,button_id,value); - } - // Triggers destroy too - this.div.dialog("close"); + return value; }, /**