我在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
),
);
}
//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>
<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中的值。
所以大家帮帮忙。
提前谢谢,
尼西什
Panchjanya Corporation
答案 0 :(得分:2)
答案 1 :(得分:0)
真的?
有Drupal专家说你可以自定义主题中的表单。见http://www.lullabot.com/articles/modifying-forms-drupal-5-and-6