[eluser]Ickes[/eluser]
Trying to do something a little different (and perhaps illogical) but it isn't working...
When loading this page, form validation automatically runs and errors out. As a result, my set_value never sets the initial value. Any ideas?
Code:
$this->form_validation->set_rules('title', 'Title', 'required|min_length[5]|max_length[70]|xss_clean');
if($this->form_validation->run() == TRUE)
{
//YES, true - if success,
//code to update database
}
//code for form_validation->run() == FALSE
$data['title'] = $this->sample_model->_get_title();
$this->load->view('title_view', $data);
And then the "title_view"
Code:
<?php
$title = array(
'name' => 'title',
'value' => set_value('title', $title),
'size' => '70',
'maxlength' => '70'
);
?>
<b>Title:</b><br />
<?php echo form_input($title).'<br />'.form_error($title['name']);?>
Any ideas? I editted out a lot of code so if you need more, please ask. I believe the necessary info is there.
The first time the page is loaded, I receive a message "The Title field is required." and the database value $title is never shown to the user.
Thanks.