Index: guitar_cck.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/guitar/guitar_cck.module,v retrieving revision 1.2.4.4 diff -u -r1.2.4.4 guitar_cck.module --- guitar_cck.module 13 Jul 2008 12:33:14 -0000 1.2.4.4 +++ guitar_cck.module 30 Aug 2008 09:32:22 -0000 @@ -93,7 +93,8 @@ form_set_error($field['field_name'], t('Invalid chord notation')); } else { - $notes_array = explode(',', $notes); + $notes_array = $notes; + $notes = implode(',', $notes); if ($field['num_strings'] && count($notes_array) != $field['num_strings']) { form_set_error($field['field_name'], t('You must specify finger positions for @num_strings strings.', array('@num_strings' => $field['num_strings']))); } @@ -207,12 +208,19 @@ function guitar_cck_chord_input_process($element, $edit, $form_state, $form) { $field = $form['#field_info'][$element['#field_name']]; $field_key = $element['#columns'][0]; + $values = isset($element['#value'][$field_key]) ? explode(',', $element['#value'][$field_key]) : array(); $element[$field_key] = array( - '#type' => 'textfield', - '#title' => t('Notes'), - '#description' => t('A comma-separated list of numbers, indicating the fret to be played on the instrument. Use \'x\' for strings that are not played.'), - '#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL, + '#tree' => TRUE, + '#prefix' => '
', + '#suffix' => '
' . t('A comma-separated list of numbers, indicating the fret to be played on the instrument. Use \'x\' for strings that are not played.') . '
', ); + for ($i = 0; $i < $field['num_strings']; $i++) { + $element[$field_key][$i] = array( + '#type' => 'textfield', + '#size' => 3, + '#default_value' => isset($values[$i]) ? $values[$i] : NULL, + ); + } $field_key = $element['#columns'][1]; $element[$field_key] = array(