Welcome Guest, Not a member yet? Register   Sign In
Simple form_validation question (CI 1.7 SVN)
#8

[eluser]Pascal Kriete[/eluser]
[EDIT: should've refreshed]

I must be missing something. The validation library is pretty smart, all you need to do is work out the difference between 'create' and 'edit'.

Controller:
Code:
if ('create')
{
    $data = array('field' => '', 'field2' => '');
}
else
{
    $data = $model->get_current_values();
}

if ($this->validation->run() == FALSE)
{
    $this->load->view('myform', $data);
}
//...

View:
Code:
<input type="text" name="field" value="<?php echo set_value('field', $field); ?>" size="50" />
<input type="text" name="field2" value="<?php echo set_value('field2', $field2); ?>" size="50" />


Messages In This Thread
Simple form_validation question (CI 1.7 SVN) - by El Forum - 09-12-2008, 06:30 PM
Simple form_validation question (CI 1.7 SVN) - by El Forum - 09-12-2008, 10:32 PM
Simple form_validation question (CI 1.7 SVN) - by El Forum - 09-12-2008, 11:54 PM
Simple form_validation question (CI 1.7 SVN) - by El Forum - 09-13-2008, 03:37 AM
Simple form_validation question (CI 1.7 SVN) - by El Forum - 09-13-2008, 10:07 AM
Simple form_validation question (CI 1.7 SVN) - by El Forum - 09-13-2008, 10:13 AM
Simple form_validation question (CI 1.7 SVN) - by El Forum - 09-13-2008, 10:26 AM
Simple form_validation question (CI 1.7 SVN) - by El Forum - 09-13-2008, 10:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB