webmcp
diff framework/env/ui/form.lua @ 223:32ec28229bb5
Finished removing all references to cgi module (except demo-app); Removed partial loading mechanism
| author | jbe |
|---|---|
| date | Fri Feb 27 21:49:00 2015 +0100 (2015-02-27) |
| parents | ca88032cb37c |
| children |
line diff
1.1 --- a/framework/env/ui/form.lua Fri Feb 27 17:18:08 2015 +0100 1.2 +++ b/framework/env/ui/form.lua Fri Feb 27 21:49:00 2015 +0100 1.3 @@ -20,13 +20,6 @@ 1.4 error = { ... }, -- routing when "error" is returned by the called action 1.5 ... = { ... } -- routing when "..." is returned by the called action 1.6 }, 1.7 - partial = { -- parameters for partial loading, see below 1.8 - module = module, 1.9 - view = view, 1.10 - id = id, 1.11 - params = params, 1.12 - target = target 1.13 - }, 1.14 content = function() 1.15 ... -- code creating the contents of the form 1.16 end 1.17 @@ -34,10 +27,6 @@ 1.18 1.19 This functions creates a web form, which encloses the content created by the given 'content' function. When a 'record' is given, ui.field.* helper functions will be able to automatically determine field values by using the given record. If 'read_only' is set to true, then a call of ui.submit{...} will be ignored, and ui.field.* helper functions will behave differently. 1.20 1.21 -When passing a table as "partial" argument, AND if partial loading has been enabled by calling ui.enable_partial_loading(), then ui._partial_load_js is 1.22 -used to create an onsubmit event. The "partial" setting table is passed to ui._partial_load_js as first argument. See ui._partial_load_js(...) for 1.23 -further documentation. 1.24 - 1.25 --]]-- 1.26 1.27 local function prepare_routing_params(params, routing, default_module) 1.28 @@ -99,45 +88,6 @@ 1.29 action = args.action, 1.30 } 1.31 attr.method = args.method and string.upper(args.method) or "POST" 1.32 - if ui.is_partial_loading_enabled() and args.partial then 1.33 - attr.onsubmit = slot.use_temporary(function() 1.34 - local partial_mode = "form_normal" 1.35 - if args.action then 1.36 - partial_mode = "form_action" 1.37 - slot.put( 1.38 - 'var element; ', 1.39 - 'var formElements = []; ', 1.40 - 'for (var i=0; i<this.elements.length; i++) { ', 1.41 - 'formElements[formElements.length] = this.elements[i]; ', 1.42 - '} ', 1.43 - 'for (i=0; i<formElements.length; i++) { ', 1.44 - 'element = formElements[i]; ', 1.45 - 'if (element.name.search(/^_webmcp_routing\\./) >= 0) { ', 1.46 - 'element.parentNode.removeChild(element); ', 1.47 - '} ', 1.48 - '}' 1.49 - ) 1.50 - local routing_params = {} 1.51 - prepare_routing_params( 1.52 - routing_params, 1.53 - args.partial.routing, 1.54 - args.partial.module 1.55 - ) 1.56 - for key, value in pairs(routing_params) do 1.57 - slot.put( 1.58 - ' ', 1.59 - 'element = document.createElement("input"); ', 1.60 - 'element.setAttribute("type", "hidden"); ', 1.61 - 'element.setAttribute("name", ', encode.json(key), '); ', 1.62 - 'element.setAttribute("value", ', encode.json(value), '); ', 1.63 - 'this.appendChild(element);' 1.64 - ) 1.65 - end 1.66 - slot.put(' ') 1.67 - end 1.68 - slot.put(ui._partial_load_js(args.partial, partial_mode)) 1.69 - end) 1.70 - end 1.71 if slot_state.form_opened then 1.72 error("Cannot open a non-readonly form inside a non-readonly form.") 1.73 end