欢迎各位兄弟 发布技术文章
这里的技术是共享的
function js_jamf_modify_name_form($form,&$form_state,$a_computer_info)
{
if(!empty($_POST['name'])){
$name_default_value = _removeCnEnSpace($_POST['name']);
}else if(!empty($a_computer_info['computer_name'])){
$name_default_value = _removeCnEnSpace($a_computer_info['computer_name']);
}
$form['id'] = array('#type' => 'hidden', '#value' => $a_computer_info['computer_id']);
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('计算机名称:'),
'#size' => 30,
'#required' => TRUE,
'#default_value' =>$name_default_value,
);
$form['submit'] = array('#type' => 'submit', '#value' => t('改名'));
$form['#attributes']['class'] = 'js_ise_form_class';
// $e = kprint_r($form,TRUE);
// print $e;
return $form;
}
调用form
drupal_get_form('js_jamf_modify_name_form',$a_computer_info)