drupal confirm_password field set description under both textboxes in drupal
i have an confirm password field in the drupal and i need to set description for both the text boxes and i tried this.
$form['pass[pass1]']['#description'] = 'textbox开发者_C百科1';
$form['pass[pass2]']['#description'] = 'textbox2';
is that possible . can any one please explain how to do it .
i tried this too.
$form['pass']['pass1']['#description'] = 'textbox1';
$form['pass']['pass2']['#description'] = 'textbox2';
for both code nothing changes in the gui
The password field gets split into two in the expand_password_confirm function (called pass1 and pass2 like you've got above so I guess you probably already know that). You can probably change the descriptions in a form pre render function, so in your form put:
$form['#pre_render'] = array('MYMODULE_my_form_pre_render');
And then create the following function:
function MYMODULE_my_form_pre_render(&$form) {
$form['pass']['pass1']['#description'] = 'textbox1';
$form['pass']['pass2']['#description'] = 'textbox2';
}
Hope that helps
精彩评论