If a time value is sent with minutes as '00' then the field will show as empty when viewing results.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

realityloop’s picture

It looks like the data is being stored in the DB, but the display view shows nothing for that field

quicksketch’s picture

Priority: Critical » Normal

Thanks for the report. Definitely not a "critical" issue though.

realityloop’s picture

Status: Active » Needs review
FileSize
0 bytes

Patch attached

Can't seem to attach files at the moment :/

Index: components/time.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform/components/time.inc,v
retrieving revision 1.24.2.8
diff -u -p -r1.24.2.8 time.inc
--- components/time.inc	26 Mar 2010 00:09:10 -0000	1.24.2.8
+++ components/time.inc	28 Jun 2010 06:20:03 -0000
@@ -251,7 +251,7 @@ function _webform_display_time($componen
  */
 function theme_webform_display_time($element) {
   $output = ' ';
-  if ($element['#value']['hour'] && $element['#value']['minute']) {
+  if ($element['#value']['hour']) {
     if ($element['#hourformat'] == '24-hour') {
       $output = sprintf('%02d', $element['#value']['hour']) . ':' . sprintf('%02d', $element['#value']['minute']);
     }

realityloop’s picture

FileSize
764 bytes

Patch attached succesfully..

quicksketch’s picture

Status: Needs review » Needs work

Hour could also be 0 if you're using a 24-hour clock. We should probably check that these values are not NULL rather than letting PHP consider 0 to be empty.

realityloop’s picture

Status: Needs work » Needs review
FileSize
815 bytes

Patch attached that checks '! is_null' on both values instead.

quicksketch’s picture

Rather than ! is_null (), isset() would probably be a tad more efficient approach. Either way we won't want to add in the extra space before and after the function call, per the Drupal coding standards.

realityloop’s picture

FileSize
805 bytes

patch updated to isset

quicksketch’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

quicksketch’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

AlanY’s picture

This is happening for text fields as well.

Even for required fields, when a '0' value is entered the submission view shows blank and the email shows blank also.

Haven't tested textareas, selects.

AlanY’s picture

Status: Fixed » Needs work

Would changing line 178 to ! is_null() in textfield.inc help?

/**
 * Implementation of _webform_display_component().
 */
function _webform_display_textfield($component, $value, $format = 'html') {
  return array(
    '#title' => $component['name'],
    '#weight' => $component['weight'],
    '#theme' => 'webform_display_textfield',
    '#theme_wrappers' => $format == 'html' ? array('webform_element') : array('webform_element_text'),
    '#post_render' => array('webform_element_wrapper'),
    '#field_prefix' => $component['extra']['field_prefix'],
    '#field_suffix' => $component['extra']['field_suffix'],
    '#component' => $component,
    '#format' => $format,
    '#value' => isset($value[0]) ? $value[0] : '',
  );
}
realityloop’s picture

Status: Needs work » Closed (fixed)

AlanY that is a separate issue please post new issue