I am learning Drupal 7. I have a custom module, trying to modify a date form element in my page. I have the form id identified, and Devel module list me all the fields in this page, I think I am typing the correct field name but it doesn't work, It creates a new form element instead of modify the form element.
Maybe the element is inside a fieldset, but I don't know how to write the correct line to modify. It is a datepicker and I am trying to modify the minDate property for the date element.
Here is my code:
function davidcustom_form_alter(&$form, &$form_state, $form_id) {
drupal_set_message($form_id); // print form ID to messages
// Check when the right form is passed
if ($form_id == 'commerce_cart_add_to_cart_form_24296') {
$form['field_line_item_fecha_reserva'] = array(
'#title' => t('Pick the desired date'),
'#type' => 'date_popup',
'#datepicker_options' => array(
'minDate' => 10,
),
);
}
}