func comments, treat "" as null
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 13 Feb 2009 16:14:40 +0000 (16:14 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 13 Feb 2009 16:14:40 +0000 (16:14 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12170 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js

index 038a332..a7f967d 100644 (file)
@@ -40,10 +40,14 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
         },
 
         /**
-         * Turn the value from the dojo widget into a value oils understands
+         * Turn the widget-stored value into a value oils understands
          */
         getFormattedValue : function() {
             var value = this.baseWidgetValue();
+
+            /* text widgets default to "" when no data is entered */
+            if(value == '') return null; 
+
             switch(this.idlField.datatype) {
                 case 'bool':
                     return (value) ? 't' : 'f'
@@ -60,6 +64,9 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
             return this.widget.attr(attr);
         },
         
+        /**
+         * Turn the widget-stored value into something visually suitable
+         */
         getDisplayString : function() {
             var value = this.widgetValue;
             switch(this.idlField.datatype) {