Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Update system/libraries/Form_validation.php #947

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
3 participants
Contributor

dionysiosarvanitis commented Jan 20, 2012

Problems with repopulating fields if form_validation is loaded (Issue #104)

If you do not specifiy a rule in the form validation, set_value in form_helper.php returns empty or sets default value for that field, instead of the postdata.

@philsturgeon philsturgeon and 1 other commented on an outdated diff Jan 20, 2012

system/libraries/Form_validation.php
{
- return $default;
+ if( $this->CI->input->post($field)===FALSE)
@philsturgeon

philsturgeon Jan 20, 2012

Contributor

Could you please follow the style guide for spacing, tabs and if statements?

http://codeigniter.com/user_guide/general/styleguide.html

Thank you! :)

@dionysiosarvanitis

dionysiosarvanitis Jan 20, 2012

Contributor

I'm trying !

@philsturgeon philsturgeon commented on an outdated diff Jan 20, 2012

system/libraries/Form_validation.php
{
- return $default;
+ if ( $this->CI->input->post($field) === FALSE)
@philsturgeon

philsturgeon Jan 20, 2012

Contributor

Sorry dude but it's if ($this....

@philsturgeon philsturgeon and 1 other commented on an outdated diff Jan 20, 2012

system/libraries/Form_validation.php
@@ -738,15 +745,23 @@ public function set_select($field = '', $value = '', $default = FALSE)
{
if ( ! isset($this->_field_data[$field]) OR ! isset($this->_field_data[$field]['postdata']))
{
- if ($default === TRUE AND count($this->_field_data) === 0)
- {
- return ' selected="selected"';
+ if( ! ($this->CI->input->post($field) === FALSE))
+ {
+ $field = $this->CI->input->post($field);
+ }
+ else
+ {
@philsturgeon

philsturgeon Jan 20, 2012

Contributor

Also spacing here looks pretty whack.

@dionysiosarvanitis

dionysiosarvanitis Jan 20, 2012

Contributor

I think it's ok now!
there were some spaces in front, causing the problem.

thanks for the advice.

@narfbg narfbg closed this Nov 3, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment