¿Cómo puede dar la validación de formulario de registro personalizado en Drupal?
-
02-10-2019 - |
Pregunta
He creado en Drupal 6. He utilizado cambiado el comportamiento de la página de registro Drupal añadiendo este código en temas. archivo de plantilla
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
),
);
}
y mi archivo user_register.tpl.php está buscando como este ...
//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>
Como hacer la validación en "my_text_field", que se custmized.
y exactamente lo que quiero que tan pronto como el usuario haga clic en el selector de fecha y hora my_text_field entonces debe ser abierta y cualquiera que sea el usuario seleccione la fecha, esa fecha debe ser de valor en my_text_field.
Así que chicos ayuda.
Gracias de antemano, España
nitish
Panchjanya Corporación
Solución
Esto es absolutamente incorrecto.
hook_form_alter () a formas alternas. Que no pertenece en la capa de decoración temática.
Para implementar la lógica de validación personalizada, utilice un # Validar devolución de llamada .
Otros consejos
En serio?
Hay expertos que dicen Drupal puede personalizar la forma en el tema. Ver http://www.lullabot.com/articles/modifying- formas-drupal-5-y-6