Welcome Guest, Not a member yet? Register   Sign In
set_value() not working on custom validation field
#1

[eluser]ci_user[/eluser]
set_value() not working on custom validation field. The posted value for the custom validation field comes back empty on page reload when validation fails.

The view:
Code:
$date = array(
'name' => 'date',
'value' => set_value('date'),
'id' => 'datepicker'
);
&lt;?=form_error('date');?&gt;<label>Date: </label>&lt;?=form_input($date);?&gt;

The controller:
Code:
$this->form_validation->set_rules('date', 'Date', 'trim|required|valid_date');
$this->form_validation->set_message('valid_date', 'The date format must be dd/mm/yyyy.');

My_Form_Validation:
Code:
public function valid_date($val)
    {
        if(!preg_match('^(0[1-9]|1[012])[/](0[1-9]|[12][0-9]|3[01])[/](19|20)\d\d$^', $val)){
return false;
     }
}


Messages In This Thread
set_value() not working on custom validation field - by El Forum - 07-30-2012, 07:13 AM
set_value() not working on custom validation field - by El Forum - 07-30-2012, 01:04 PM
set_value() not working on custom validation field - by El Forum - 07-30-2012, 01:06 PM
set_value() not working on custom validation field - by El Forum - 07-30-2012, 01:09 PM
set_value() not working on custom validation field - by El Forum - 07-30-2012, 01:11 PM
set_value() not working on custom validation field - by El Forum - 07-30-2012, 01:13 PM
set_value() not working on custom validation field - by El Forum - 07-30-2012, 09:42 PM
set_value() not working on custom validation field - by El Forum - 08-31-2013, 04:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB