Created
December 30, 2010 08:49
-
-
Save crackcomm/759606 to your computer and use it in GitHub Desktop.
Is there another, better method to get same effect in view ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo Form::open(); | |
echo Form::label('username', __('Username')); ?> | |
<p><?php echo Form::input('username', $input['username']); ?></p> | |
<?php if(isset($errors['username'])) echo "<p>{$errors['username']}</p>"; ?> | |
<?php echo Form::label('password', __('Password')); ?> | |
<p><?php echo Form::password('password', $input['password']); ?></p> | |
<?php if(isset($errors['password'])) echo "<p>{$errors['password']}</p>"; ?> | |
<?php echo Form::label('password_confirm', __('Repeat password')); ?> | |
<p><?php echo Form::password('password_confirm', $input['password_confirm']); ?></p> | |
<?php if(isset($errors['password_confirm'])) echo "<p>{$errors['password_confirm']}</p>"; ?> | |
<?php echo Form::label('email', __('E-mail address')); ?> | |
<p><?php echo Form::input('email', $input['email']); ?></p> | |
<?php if(isset($errors['email'])) echo "<p>{$errors['email']}</p>"; ?> | |
<p><?php echo Form::submit('submit', __('Register')) ?></p> | |
<?php echo Form::close(); ?> |
Extend the Kohana Form class with your own.
- Pass the errors list to the form by adding your own method e.g. Form::set_errors($errors);
- Override the input() method and put the isset() check and print logic in your overridden function.
Example code: (application/classes/form.php)
{Form::$form_errors[$name]}"; return $markup; } ``` }
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@crackcomm