// this generates the dialog the appears on the focus event // it accepta the following options // and can't proceed unless they are all filled in // inputField = $() // hdnSettingsField = $() // settings = {} // dialogcontrols = [{ // id: '', // class: '', // labelText: '', // inputType: '', // value: '', // field: '', // options: {}, // validate // }]; ;(function ( $, window, document, undefined ) { var pluginName = "settingsDialog"; // constructor function SettingsDialog( element, options ) { this.element = element; this.options = $.extend( {}, $.fn.settingsDialog.options, options ); this._name = pluginName; this.init(); } SettingsDialog.prototype.init = function() { // here we build up the controls.... var $element = $(this.element); var $hdnSettingsField = $('input[type=hidden]', $element); var $inputField = $('input[type=text]', $element); var properties = {}; if ($hdnSettingsField.val() !== '') { try { properties = JSON.parse($hdnSettingsField.val()); } catch (err) { debugger; var t = $hdnSettingsField.val() } } var $dialog = $('
').attr('id', 'dialog_' + $element.attr('id')); $.each( this.options.dialogControls, function( index, control ) { // 1. create the label // 2. create the input var $label = $('