Drupal7 Form Hidden Field ID Attribute Not Found

Share on TwitterDigg This

Created a form hidden input it does not found the attribute ‘id’.

$form['userid']= array(
     '#type' => 'hidden',
     '#title' => t('Name'),
);

Normally this input form have id=’edit-userid’. In D7 RC1, this input doesn’t have any atribute id.

Add id attribute to drupal7 hidden input form

$form['userid'] = array(
    '#type' => 'hidden',
    '#attributes' => array('id' => 'hidden-id'),
  );

Add id attribute to drupal7 hidden input form using jquery

$('input[name="userid"]').attr('id', 'your-id-value');

Related

About prabin t p

Connect with me on Google+
This entry was posted in Drupal, Drupal7 and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

*