Welcome Guest, Not a member yet? Register   Sign In
Show Blank Form After Successful Validation/Insertion
#1

[eluser]Unknown[/eluser]
I am using jQuery + CI and have a form that after it successfully passes validation rules and successfully inserts the form fields into the database, the cached variables are cached and are the default values for the form after submission. After submission, I want a blank form.

Here is some code:


Code:
<div>
        <div class="leftcol">property number</div>
        <span>
                &lt;?=form_input( array('name' => 'prop_no', 'id' => 'prop_no', 'value' => $this->validation->prop_no ) );?&gt;
                <span id="prop_no_status"></span>
                &lt;?php echo $this->validation->prop_no_error; ?&gt;
        </span>
    </div>

The $this->validation->prop_no seems to be getting cached and stays as the default value.

I tried getting around this by adding a flush() method to the Validation.php class like so but it does not work:


Code:
function flush()
    {
        foreach($this->_rules as $key => $rule) :
        
            $errvar = '$this->' . $key . '_error';
            $this->$errvar = "";

            $errvar = '$this->' . $key;
            $this->$errvar = "";

        endforeach;

        

    }




Theme © iAndrew 2016 - Forum software by © MyBB