0

I want add the attribute autocomplete="Off" in the input field of the date field. I've created a modulo with hook_form_alter but not works. This is my code:

function no_input_autocomplete_form_alter(&$form, &$form_state, $form_id) {
    if($form_id === 'prenotazione_node_form'){
        $form['field_periodo_prenotazione_to']['#attributes'] = array('autocomplete' => 'Off');
    }
}

I've noticed that with other field type works as I expect.

How can solve it?

1 Answer 1

1

Try with

$form['field_periodo_prenotazione_to']['widget'][0]['value']['#attributes'] = array('autocomplete' => 'Off');
1
  • I've already try this but not works
    – kb8
    Commented Jun 8, 2018 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.