Skip to main content
replaced http://drupal.stackexchange.com/ with https://drupal.stackexchange.com/
Source Link

This is what will work

 $form['#prefix'] = '<div class="nano-ui">'; $form['#suffix'] = '</div>'; $form['name']['#title'] = Null; // Change text on form $form['name']['#attributes'] = array('placeholder' => t('username')); $form['pass']['#title'] = Null; $form['pass']['#attributes'] = array('placeholder' => t('password')); $form['name']['#attributes']['class'][] = 'nui-input'; 

Here is the reference : How do I use hook_form_alter() to add CSS classes to a custom input field in user_register_form?How do I use hook_form_alter() to add CSS classes to a custom input field in user_register_form?

This is what will work

 $form['#prefix'] = '<div class="nano-ui">'; $form['#suffix'] = '</div>'; $form['name']['#title'] = Null; // Change text on form $form['name']['#attributes'] = array('placeholder' => t('username')); $form['pass']['#title'] = Null; $form['pass']['#attributes'] = array('placeholder' => t('password')); $form['name']['#attributes']['class'][] = 'nui-input'; 

Here is the reference : How do I use hook_form_alter() to add CSS classes to a custom input field in user_register_form?

This is what will work

 $form['#prefix'] = '<div class="nano-ui">'; $form['#suffix'] = '</div>'; $form['name']['#title'] = Null; // Change text on form $form['name']['#attributes'] = array('placeholder' => t('username')); $form['pass']['#title'] = Null; $form['pass']['#attributes'] = array('placeholder' => t('password')); $form['name']['#attributes']['class'][] = 'nui-input'; 

Here is the reference : How do I use hook_form_alter() to add CSS classes to a custom input field in user_register_form?

added 372 characters in body
Source Link
Bhuvana
  • 661
  • 5
  • 18

This is what will work

 $form['#prefix'] = '<div class="nano-ui">'; $form['#suffix'] = '</div>'; $form['name']['#title'] = Null; // Change text on form $form['name']['#attributes'] = array('placeholder' => t('username')); $form['pass']['#title'] = Null; $form['pass']['#attributes'] = array('placeholder' => t('password')); $form['name']['#attributes']['class'][] = 'nui-input'; 

Here is the reference : How do I use hook_form_alter() to add CSS classes to a custom input field in user_register_form?

This is what will work

$form['name']['#attributes']['class'][] = 'nui-input'; 

Here is the reference : How do I use hook_form_alter() to add CSS classes to a custom input field in user_register_form?

This is what will work

 $form['#prefix'] = '<div class="nano-ui">'; $form['#suffix'] = '</div>'; $form['name']['#title'] = Null; // Change text on form $form['name']['#attributes'] = array('placeholder' => t('username')); $form['pass']['#title'] = Null; $form['pass']['#attributes'] = array('placeholder' => t('password')); $form['name']['#attributes']['class'][] = 'nui-input'; 

Here is the reference : How do I use hook_form_alter() to add CSS classes to a custom input field in user_register_form?

Source Link
Bhuvana
  • 661
  • 5
  • 18

This is what will work

$form['name']['#attributes']['class'][] = 'nui-input'; 

Here is the reference : How do I use hook_form_alter() to add CSS classes to a custom input field in user_register_form?