我在 drupal 6 中创建了自定义注册表单。我通过在主题中添加此代码来更改了 drupal 注册页面的行为。模板文件
function earthen_theme($existing, $type, $theme, $path) {
return array(
// tell Drupal what template to use for the user register form
'user_register' => array(
'arguments' => array('form' => NULL),
'template' => 'user_register', // this is the name of the template
),
);
}
我的 user_register.tpl.php 文件看起来像这样......
//php tag starts from here
$forms['access'] = array(
'#type' => 'fieldset',
'#title' => t('Access log settings'),
);
$form['my_text_field']=array( '#type' => 'textfield',
'#default_value' => $node->title,
'#size' => 30,
'#maxlength' => 50,
'#required' => TRUE
);
<div id="registration_form"><br>
<div class="field">
<?php
print drupal_render($form['my_text_field']); // prints the username field
?>
</div>
<div class="field">
<?php
print drupal_render($form['account']['name']); // prints the username field
?>
</div>
<div class="field">
<?php
print drupal_render($form['account']['pass']); // print the password field
?>
</div>
<div class="field">
<?php
print drupal_render($form['account']['email']); // print the password field
?>
</div>
<div class="field">
<?php
print drupal_render($form['submit']); // print the submit button
?>
</div>
</div>
如何对自定义的“my_text_field”进行验证。
正是我希望用户单击 my_text_field 时,日期时间选择器应该打开,并且无论用户选择哪个日期,该日期都应该是 my_text_field 中的值。
所以大家帮忙。
在此先感谢
nitish
Panchjanya Corporation