From 5b1b6eed3243cf4113665d31134e76efa4195e0a Mon Sep 17 00:00:00 2001 From: Tyler Frankenstein Date: Fri, 6 Sep 2013 01:04:35 -0400 Subject: [PATCH] #160. Changed _image_field_form_validate() to return if no image is present on field. --- modules/image/image.js | 3 ++- modules/taxonomy/taxonomy.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/image/image.js b/modules/image/image.js index 7d2852fa..ddb69375 100644 --- a/modules/image/image.js +++ b/modules/image/image.js @@ -124,6 +124,8 @@ function _image_phonegap_camera_getPicture_success(options) { function _image_field_form_validate(form, form_state) { try { $.each(form.image_fields, function(index, name){ + // Skip empty images. + if (!image_phonegap_camera_options[name][0]) { return; } // Create a unique file name using the UTC integer value. var d = new Date(); var image_file_name = "" + d.valueOf() + ".jpg"; @@ -143,7 +145,6 @@ function _image_field_form_validate(form, form_state) { }); }); dpm(form_state); - alert('_image_field_form_validate'); } catch (error) { drupalgap_error(error); } } diff --git a/modules/taxonomy/taxonomy.js b/modules/taxonomy/taxonomy.js index c3318a53..91a3a481 100644 --- a/modules/taxonomy/taxonomy.js +++ b/modules/taxonomy/taxonomy.js @@ -494,6 +494,10 @@ function _theme_taxonomy_term_reference_load_items(options) { if (terms.length > 0) { $.each(terms, function(index, term){ var option = ''; + // TODO - this line of code searches the DOM on every iteration, + // the reference to the widget should be set to a variable + // before the loop. This performance improvement should be used + // probably hundreds of spots within DrupalGap, doh! $('#' + options.widget_id).append(option); }); }