Welcome Guest, Not a member yet? Register   Sign In
set_value | set_select | etc. works only with rule applied on its element
#1

[eluser]Jay Gridley[/eluser]
Hi foks,

I have form for creating new page in my CMS. I am validating some fields with form_validation library. I have several input boxes in my form. Few of them are validated using rules, BUT other input boxes are not.

All these input boxes has value set up with set_value(), BUT only boxes, which are validated have previosly inputed value filled in, when error during validation came up. Others NOT! Am I getting something wrong or it is bug?

Example:
Code:
$urlInput = array(
        'name' => 'url',
        'id' => 'url',
        'value' => set_value('url'),
        'maxlength' => '255',
        'size' => '50'
    );
    $pageInfo .= form_label('URL','url'); [color=red]//THIS INPUT BOX IS VALIDATED[/color]
    $pageInfo .= form_input($urlInput);

$timeInput = array(
        'name' => 'time',
        'id' => 'time',
        'value' => set_value('time'),
        'maxlength' => '8'
    );
    $pageInfo .= form_label('Time','time'); [color=red//THIS ONE NOT[/color]
    $pageInfo .= form_input($timeInput);
When there is an error during the validation process (some other box should be filled, but it is empty), so I am loading view with form again (with error message) and input box for URL has value, which I entered last time (before validation). I also entered value into time input box (before validation), but after validation, my value for this input box is lost.

I figgured out, if I setup rule for time input box, after validation it is filled with previosly entered value. So, this is my point. Did you get it? Same problem with other methods for checkboxes or selectboxes.


Messages In This Thread
set_value | set_select | etc. works only with rule applied on its element - by El Forum - 06-09-2010, 10:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB