When creating/editing a node on the english side all works ok but when this is done on the arabic side it breaks up the am/pm form.
The markup values also change unlike on the month or hour fields. I think this causes the content to become invalid and it prevents the node from being saved.

I'm guessing this happens with other languages that might use different characters.

Can this be corrected?

<select class="date-ampm form-select" id="edit-field-date-und-0-value-ampm" name="field_date[und][0][value][ampm]">
   <option value=""></option>
   <option value="am" selected="selected">am</option>
   <option value="pm">pm</option></select>
<select class="date-ampm form-select" id="edit-field-date-und-0-value-ampm" name="field_date[und][0][value][ampm]">
   <option value=""></option>
   <option value="صباحاً">صباحاً</option>
   <option value="مساءاً">مساءاً</option>
</select>

Thanks in advance for any helpful clue!

Comments

pedromvpg’s picture

Component: Translation » User interface
DamienMcKenna’s picture

Version: 7.x-2.7 » 7.x-2.x-dev
Issue tags: -date, -pm, -am, -input, -select

Oh! yeah, it looks like the array key is being translated too, which it shouldn't be.

DamienMcKenna’s picture

Can you please install the Devel module, edit date_api_elements.inc and on roughly line 680 (after the if($element['#date_label_position'] == 'within') bit still inside the if(($hours_format == 'g' bit), add the following: dpm($sub_element); so it looks like this:

  if (($hours_format == 'g' || $hours_format == 'h') && date_has_time($granularity)) {
    $label = theme('date_part_label_ampm', array('part_type' => 'ampm', 'element' => $element));
    $sub_element['ampm'] = array(
      '#type' => 'select',
      '#theme' => 'date_select_element',
      '#title' => $label,
      '#title_display' => in_array($element['#date_label_position'], array('within', 'none')) ? 'invisible' : 'before',
      '#default_value' => is_object($date) ? (date_format($date, 'G') >= 12 ? 'pm' : 'am') : '',
      '#options' => drupal_map_assoc(date_ampm($part_required)),
      '#required' => $part_required,
      '#weight' => 8,
      '#attributes' => array('class' => array('date-ampm')),
    );
    if ($element['#date_label_position'] == 'within') {
      $sub_element['ampm']['#options'] = array('' => '-' . $label) + $sub_element['ampm']['#options'];
    }
    dpm($sub_element);
  }

Please upload a screenshot of the #options values.

FYI leaving this as "critical" as the bug renders the node uneditable.

DamienMcKenna’s picture

Priority: Critical » Normal
Status: Active » Closed (cannot reproduce)

The HTML tags are generated by Drupal, not the Date module, so I wonder if something was broken in the site's theme?