Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Removed reset_validation() method from run() method #1127

Merged
merged 0 commits into from

4 participants

@JonoB

Reference #1126 and #1121

@philsturgeon

Just as a quick thought, could this not be run after all execution in run()? It was being run pretty high up before, but surely it could be run RIGHT at the end?

@JonoB

I think that the problem with that is that it clears all the validation error messages...so if you try get _error_array() or $_error_messages after run() they will be empty.

@it-can

Jup tested that yesterday... Does not show the errors...

@philsturgeon
@JonoB

So:
At the start of run():
$this->_error_array = array();
$this->_error_messages = array();
$this->error_string = '';

At the end of run():
$this->_field_data = array();
$this->_config_rules = array();

@IT-Can Can you have a quick test to see if that works please?

@it-can

okido, couple of minutes....

@it-can

Ok seems to work (in my case)... I am getting all messages like before...

@JonoB

OK, cool, thanks. Will adjust accordingly.

@JonoB

Thanks for the help @IT-Can

Hopefully this is good to go now.

@it-can

@JonoB thanks for the quick response ;-)

@quasiperfect

not sure if related but form_error('field') returns nothing while validation_errors() works

@JonoB

@quasiperfect Which code are you running this on? Can you try the suggested changes in #1127 (comment) please?

@quasiperfect

@JonoB i tried with the form_validation file from your git
i verified and it contains the code from the comment and after some testing i think $this->_field_data = array() (at the end of run) is the problem because it empties the array so when the helper calls the error function it failes at the first condition the
$this->_field_data[$field] is not set

so to fix in function error we should use $this->_error_array[$field] insted of $this->_field_data[$field]['error']

correct me if i'm wrong

@quasiperfect

not tested but i'm sure will be problems with set_value and other form helper methods that relay on $this->_field_data

Edit: yeap i was right

@it-can

Ok, I can confirm that set_value is not working correctly with the latest changes...

I have an email-field, requires a valid email, but with the latest changes it gives an error that the email is not correct, but set_value shows the original value instead of the posted value....

@it-can

@JonoB Is this fixable?

@philsturgeon

Bah ok, looks like we just can't reset things. Reliance on the singleton is just too much. We'll just have to accept that if you do two forms in one page you need to reset it.

@JonoB

Unfortunately, without a major re-write of form_validation library, we will have to accept that user will have to manually clear it.

@philsturgeon Is it possible to merge in the first pull request (JonoB@8af2fdf) in this thread and not the second?

@JonoB JonoB merged commit 099c478 into bcit-ci:develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 0 additions and 0 deletions.
Something went wrong with that request. Please try again.