Module: nagvis Branch: master Commit: 21cf6b2f3eecd6550ea2af2453437d9558925576 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=21cf6b2f3eecd6550ea2af2453437d9558925576
Author: LaMi <[email protected]> Date: Sun Jan 17 17:32:44 2010 +0100 Removed confusing removal of default values in form fields when submitting the addmodify dialog in WUI --- share/frontend/nagvis-js/js/ajax.js | 18 +++++++++++++++++- share/frontend/wui/js/addmodify.js | 6 +++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/share/frontend/nagvis-js/js/ajax.js b/share/frontend/nagvis-js/js/ajax.js index 96bb822..414c5d4 100644 --- a/share/frontend/nagvis-js/js/ajax.js +++ b/share/frontend/nagvis-js/js/ajax.js @@ -432,6 +432,15 @@ function getFormParams(formId) { for(var i = 0, len = aFields.length; i < len; i++) { // Filter helper fields (NagVis WUI specific) if(aFields[i].name.charAt(0) !== '_') { + // Skip options which use the default value + var oFieldDefault = document.getElementById('_'+aFields[i].name); + if(aFields[i] && oFieldDefault) { + if(aFields[i].value === oFieldDefault.value) { + continue; + } + } + oFieldDefault = null; + if(aFields[i].type == "hidden") { sReturn += aFields[i].name + "=" + escapeUrlValues(aFields[i].value) + "&"; } @@ -465,7 +474,14 @@ function getFormParams(formId) { for(var i = 0, len = aFields.length; i < len; i++) { // Filter helper fields (NagVis WUI specific) if(aFields[i].name.charAt(0) !== '_') { - // Check if the value of the input helper field should be used (NagVis WUI specific) + // Skip options which use the default value + var oFieldDefault = document.getElementById('_'+aFields[i].name); + if(aFields[i] && oFieldDefault) { + if(aFields[i].value === oFieldDefault.value) { + continue; + } + } + oFieldDefault = null; // Maybe nothing is selected var sel = -1; diff --git a/share/frontend/wui/js/addmodify.js b/share/frontend/wui/js/addmodify.js index a295167..124eeac 100644 --- a/share/frontend/wui/js/addmodify.js +++ b/share/frontend/wui/js/addmodify.js @@ -97,14 +97,14 @@ function validateMapCfgForm() { if(document.addmodify.elements[i].name.charAt(0) !== '_') { var sName = document.addmodify.elements[i].name; - // Empty options which use the default value + // Skip options which use the default value var oField = document.getElementById(sName); var oFieldDefault = document.getElementById('_'+sName); if(oField && oFieldDefault) { - // Reset option only when the field and default value are equal + // Skip option only when the field and default value are equal if(oField.value === oFieldDefault.value) { - oField.value = ''; + continue; } } ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
