Welcome Guest, Not a member yet? Register   Sign In
Form helper set_radio and set_checkbox after update to CI 3.04
#1

Hi,

I updated my project from Ci 3.03 to 3.04. After that form helper set_radio() and set checkbox() works different way so it break my forms.

Anybody notices also issue with set_radio() and set checkbox() in CI 3.04?

I think it should be better explain in changelog because it works different than before and change behavior of set_radio() and set_checkobx!

Maybe it is an error in form helper set_radio() and set checkbox() ?

From changelog CI 3.04:
"Fixed a bug where Form Helper functions set_checkbox(), set_radio() didn’t “uncheck” inputs on a submitted form if the default state is “checked”."
Reply
#2

If the changelog entry isn't good enough, then what is?
Reply
#3

In changelog there is information about bug fix set_checkbox(), set_radio() not about this that functions working different.
Bug fix should fix a bug and don't change standard function results. If result of function has been changed it shold be written in Upgrading from 3.0.3 to 3.0.4.

In CI before 3.04 if I submit form without setting validation config rules ($this->form_validation->set_rules($config)Wink
all data in form will be repopulated including checkboxes and radios without validation.
In CI 3.04 all data will be repopulated excluding checkboxes and radios.
So I only want to know is this a new bug in helper?
Reply
#4

(This post was last modified: 01-28-2016, 05:03 PM by Narf. Edit Reason: Fixed patch link )

(01-28-2016, 02:12 PM)mario Wrote: In changelog there is information about bug fix set_checkbox(), set_radio() not about this that functions working different.
Bug fix should fix a bug and don't change standard function results. If result of function has been changed it shold be written in Upgrading from 3.0.3 to 3.0.4.

Did you ever consider that the result was buggy and that is what's been fixed? Every bug fix is technically a change in behavior ... Smile

(01-28-2016, 02:12 PM)mario Wrote: In CI before 3.04 if I submit form without setting validation config rules ($this->form_validation->set_rules($config)Wink
all data in form will be repopulated including checkboxes and radios without validation.
In CI 3.04 all data will be repopulated excluding checkboxes and radios.
So I only want to know is this a new bug in helper?

I just looked into it and there seems to be a regression related to this, indeed. Patch here: https://github.com/bcit-ci/CodeIgniter/c...a179325df4
But your description is quite vague ... I can't tell you "yes" or "no", as I don't really understand what you mean.
Reply
#5

I just want to tell community that something goes wrong in 3.04 with set_checkbox(), set_radio().
Maybe I write to much and not to clear :-)
Thanks for patch :-)
Reply
#6

I found that functions: set_checkbox() and set_radio()in form_helper has strange condition which cause many problems. Applications which works fine after update in form_helper not selecting checkbox and radio in some cases.

This is that condition:

// Unchecked checkbox and radio inputs are not even submitted by browsers ...
if ($CI->input->method() === 'post')
{
return ($input === $value) ? ' checked="checked"' : '';
}

In my opinion not always data must be send by post to make checkbox checked.
Library form validation can take any array to validate so condition "if ($CI->input->method() === 'post')" is to rigorous.

With this "if ($CI->input->method() === 'post')" condition post is required. Before update functions set_checkbox() and set_radio() there is no problem to select checkbox when proper data was in $_POST array. Now it is not working because condition "if($CI->input->method() === 'post')" is required. (I use it to repopulate form after redirect so request is "get" not "post" but data is recreated to $_POST from session).
Reply




Theme © iAndrew 2016 - Forum software by © MyBB