Welcome Guest, Not a member yet? Register   Sign In
set_value(): inconsistency with multiple callbacks
#1

[eluser]Unknown[/eluser]
Hi
I've some trouble using set_value() with multiple callbacks.
As an extract:

Login Class (Controller):
Code:
...
$this->form_validation->set_rules('user', 'Username', 'trim|required|callback__activation|callback__authenticate')
...

Login View:
Code:
...
echo validation_errors('<p class="error">','</p>');
echo form_open('login/submit');
echo '<p><label for="user">Username:</label>'.form_input('user', set_value('user')).'</p>';
echo '<p><label for="pass">Password:</label>'.form_password('pass').'</p>';
echo '<p>'.form_hidden('token', $token).'</p>';
echo '<p>'.form_submit('submit', 'Login').'</p>';
echo form_close();
...

The callback _activation checks if the user has been activated yet and _authenticate checks if the username and password is valid. When I enter a valid username, that has not been activated yet I get redirected to the login form and the entered username is shown in the form so I don't need to enter it again. This is what I'm expecting.
Things change when I enter an invalid user/password combination (but with an activated user). Then the entered username will not be shown again in the reloaded form. But it should be because of set_value('user').

There is no difference when I switch the order of the callbacks. Everytime only when there's an error with the first callback the username will be rewritten in the form.

I hope you understood my problem and that anyone can help me
Best regards




Theme © iAndrew 2016 - Forum software by © MyBB