Module: nagvis
Branch: master
Commit: 708f1ce07e8092b4ef6c51aeecb4f30f8b2aa561
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=708f1ce07e8092b4ef6c51aeecb4f30f8b2aa561

Author: LaMi <[email protected]>
Date:   Sat Jan  2 13:55:58 2010 +0100

Fixed select field handling when no value is selected in WUI form processing

---

 share/frontend/nagvis-js/js/ajax.js |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/share/frontend/nagvis-js/js/ajax.js 
b/share/frontend/nagvis-js/js/ajax.js
index 56145ad..3ba2614 100644
--- a/share/frontend/nagvis-js/js/ajax.js
+++ b/share/frontend/nagvis-js/js/ajax.js
@@ -462,14 +462,21 @@ function getFormParams(formId) {
                // 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)
-                       if(typeof lang !== 'undefined' && 
aFields[i].options[aFields[i].selectedIndex].value === lang['manualInput']) {
+                       
+                       // Maybe nothing is selected
+                       var sel = -1;
+                       if(aFields[i].selectedIndex != -1) {
+                               sel = aFields[i].selectedIndex;
+                       }
+                       
+                       if(typeof lang !== 'undefined' && (sel != -1 && 
aFields[i].options[aFields[i].selectedIndex].value === lang['manualInput'])) {
                                sReturn += aFields[i].name + "=" + 
escapeUrlValues(document.getElementById('_inp_'+aFields[i].name).value) + "&";
                        } else {
                                // Can't use the selectedIndex when using 
select fields with multiple
                                if(!aFields[i].multiple || aFields[i].multiple 
!== true) {
                                        // Maybe nothing is selected
-                                       if(aFields[i].selectedIndex != -1) {
-                                               sReturn += aFields[i].name + 
"=" + escapeUrlValues(aFields[i].options[aFields[i].selectedIndex].value) + "&";
+                                       if(sel != -1) {
+                                               sReturn += aFields[i].name + 
"=" + escapeUrlValues(aFields[i].options[sel].value) + "&";
                                        }
                                } else {
                                        for(var a = 0; a < 
aFields[i].options.length; a++) {


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to