欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

对含验证码的表单的修改 改变 有大用

shiping1 的头像
function shipingzhongcustomfive_form_alter(&$form, &$form_state, $form_id)
{
if($form_id == 'user_login')
{
$form['#attributes'] = array('class' => 'loginform');
$form['name']['#attributes']=array('class' => 'nameloginform'); 
$form['name']['#size'] = 22;
// $form['name']['#value'] = 'aaaaaaaaa';
// $form['name']['#default_value'] = 'aaaaaaaaa';
$form['name']['#description']= '';
//$form['name']['#required']= false;
$form['pass']['#title']='密   码';
$form['pass']['#attributes']=array('class' => 'passloginform'); 
$form['pass']['#size'] = 22; 
$form['pass']['#description']= '';
//$form['pass']['#required']= false;
 
$form['captcha']["#after_build"][] = '_change_captcha';
 
$form['submit']['#value'] = '登录';
$form['submit']['#attributes'] = array('class' => 'submitregisterform');
$form['#submit'] = array('shipingzhongcustomfive_custom_user_login_submit');
//array_unshift($form['#submit'], 'shipingzhongcustomfive_custom_user_login_submit');
}




function _change_captcha($form, &$form_state) {
 
//$form['#required'] = true;
//$form['#required'] = true;
//$form['captcha']['#description']='';
$form['captcha_widgets']['captcha_response']['#title']='验证码';
$form['captcha_widgets']['captcha_response']['#description']='';
$form['#description']='';
$form['captcha_widgets']['captcha_response']['#size'] = 6;
//$form['captcha_widgets']['captcha_response']['#default_value'] = 'aaaaaaaa';
//$form['captcha_widgets']['captcha_response']['#value'] = 'aaaaaaaa';
//$form['#default_value'] = 'aaaaaaaa';
//$form['#value'] = 'aaaaaaaa';
//var_dump($form['captcha_widgets']['captcha_response']['#value']);
 
return $form;
}
 


 

普通分类: