A
A
Alexander Ivanov2016-02-01 10:42:45
Drupal
Alexander Ivanov, 2016-02-01 10:42:45

How to set id for submit button in Drupal 7?

In the form node, the code looks like this:

<?php print drupal_render($form['submitted']['name']); ?>
<?php print drupal_render($form['submitted']['phone']); ?>
<?php
  print ("Заявка");//test 
  print drupal_render($form['submitted']);

  print drupal_render_children($form);

How to give these buttons id="lid1"?
Here we describe the theming of the form through template.php
amiweb.ru/drupal/temizaciya-form-drupal-7-na-prime...
However, it is not specified how to set the id for submit.
I tried that but it doesn't work.
function nameform_alter(&$form, &$form_state) {
   $form['actions']['submit'] = array('#id' => 'lid1');
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2016-02-01
@cimonlebedev

function name_alter(&$form, &$form_state) {
  $form['actions']['submit']['#attributes']['id'] = "lid1";
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question