Index: branches/1.2.x/platform/inc/form_manager.js =================================================================== diff -u -N -r15752 -r15779 --- branches/1.2.x/platform/inc/form_manager.js (.../form_manager.js) (revision 15752) +++ branches/1.2.x/platform/inc/form_manager.js (.../form_manager.js) (revision 15779) @@ -151,12 +151,8 @@ } FormManager.getURL = function ($prefix, $template, $event, $params) { - var $url = this.form_param($prefix, 'url'); + var $url = this.getUrlMask($prefix); - if (!$url) { - $url = this.url; - } - if ($template === undefined) { $template = this.form_param($prefix, 'template'); } @@ -176,6 +172,23 @@ return $url; } +FormManager.getUrlMask = function ($prefix) { + // 1. look in form config + var $url = this.form_param($prefix, 'url'); + + if ( !$url ) { + // 2. look at 'action' attribute of a form + $url = this.getForm($prefix).attr('action'); + } + + if ( !$url ) { + // 3. use global fallback url + $url = this.url; + } + + return $url; +}; + FormManager.processResponse = function ($prefix, $data, $add_params) { // enable form back // alert('enabling for for [' + $prefix + '] in processResponse'); @@ -472,8 +485,7 @@ } } - var form = document.getElementById( this.form_param($prefix, 'form_id')), - $form_fields = $(form).serialize(); + var $form_fields = this.getForm($prefix).serialize(); // restore original values into input fields for (var $i = 0; $i < $fields.length; $i++) { @@ -487,6 +499,12 @@ return $form_fields; } +FormManager.getForm = function ($prefix) { + var $form_id = this.form_param($prefix, 'form_id'); + + return $('#' + jq($form_id)); +}; + FormManager.enableForm = function ($prefix, $enabled) { if ($enabled === undefined) { $enabled = true;