Author: sevein
Date: Mon Sep 19 12:40:58 2011
New Revision: 9756
Log:
Capture first item when field value is sent in an array
Modified:
trunk/js/dialog.js
Modified: trunk/js/dialog.js
==============================================================================
--- trunk/js/dialog.js Mon Sep 19 12:33:41 2011 (r9755)
+++ trunk/js/dialog.js Mon Sep 19 12:40:58 2011 (r9756)
@@ -304,21 +304,16 @@
continue;
}
- // Radio and checkbox inputs have a length > 0
- if (0 < this.fields[fieldname].length)
+ if (jQuery.isArray(thisData[fieldname]))
{
- 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
- }
-
+ thisData[fieldname] = thisData[fieldname][0];
}
- else
+
+ if ('boolean' === typeof thisData[fieldname])
+ {
+ jQuery(this.fields[fieldname]).prop('checked',
thisData[fieldname]);
+ }
+ else if ('string' === typeof thisData[fieldname])
{
this.fields[fieldname].value = thisData[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.