Author: sevein
Date: Fri Aug 19 13:14:30 2011
New Revision: 9552

Log:
Add some basic code to support checkbox data population

Modified:
   trunk/js/dialog.js

Modified: trunk/js/dialog.js
==============================================================================
--- trunk/js/dialog.js  Fri Aug 19 12:46:21 2011        (r9551)
+++ trunk/js/dialog.js  Fri Aug 19 13:14:30 2011        (r9552)
@@ -300,7 +300,24 @@
                 continue;
               }
 
-              this.fields[fieldname].value = thisData[fieldname];
+              // Radio and checkbox inputs have a length > 0
+              if (0 < this.fields[fieldname].length)
+              {
+                if ('boolean' === typeof thisData[fieldname])
+                {
+                  // TODO: extend this to be compatible with multiple radio 
inputs
+                  this.fields[fieldname][0].checked = thisData[fieldname];
+                }
+                else if ('string' === typeof thisData[fieldname])
+                {
+                  // TODO: handle arrays
+                }
+ 
+              }
+              else
+              {
+                this.fields[fieldname].value = thisData[fieldname];
+              }
 
               // Get display value for autocompletes
               if ($(this.fields[fieldname])

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to