How can give validation on custom registration form in drupal?
Posted
by Nitz
on Stack Overflow
See other posts from Stack Overflow
or by Nitz
Published on 2010-04-28T11:31:51Z
Indexed on
2010/04/28
12:03 UTC
Read the original article
Hit count: 345
Hey Friends, I have created custom registration form in drupal 6. i have used changed the behavior of the drupal registration page by adding this code in themes. template file
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
),
);
}
and my user_register.tpl.php file is looking like this...
//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>
How to make validation on "my_text_field" which is custmized.
and exactly i want that as soon as user click on my_text_field then datetime picker should be open and whichever date user select, that date should be value in my_text_field.
so guys help.
Thanks in advance,
nitish
Panchjanya Corporation
© Stack Overflow or respective owner