[eluser]darytas[/eluser]
hey,
first, thanks for listning to my problem.
it is, kinda weird, but let me explain it.
I read much about using arrays as field names in CI and it seems like something experimental or just not working as intended. I found the solution with the custom MY_Validation and MY_Input (which is no longer needed as of 1.7.1 i read somewhere) - but in the end, it's not working like a charm.
The validation only works, if I - before the validation - access every single value of the folloing by the following line.
Code:
$this->input->post('smsform[sender]');
If I put this line, then "smsform[sender]" will validate.
But, I guess that's not the way it should work, am I right?
Code:
$this->validation->set_rules( array(
'smsform[recipient]' => 'trim|css_clean|callback__checkrecipients',
'smsform[phonebook]' => 'trim|css_clean',
'smsform[sender]' => 'trim|required|css_clean',
'smsform[status]' => 'trim|required|css_clean',
'smsform[day]' => 'trim|required|css_clean|required|numeric|min_length[1]|max_length[2]',
'smsform[month]' => 'trim|required|css_clean|numeric|min_length[1]|max_length[2]',
'smsform[year]' => 'trim|required|css_clean|numeric|exact_length[4]',
'smsform[hour]' => 'trim|required|css_clean|numeric|min_length[1]|max_length[2]',
'smsform[minute]' => 'trim|required|css_clean|numeric|min_length[1]|max_length[2]',
'smsform[text]' => 'trim|required|css_clean|min_length[1]',
'smsform[gateway]' => 'trim|required|css_clean|numeric'
)
);
Form is define like this:
Code:
<input type="text" name="smsform[recipient]" id="recipient-field" class="field text large" value="<?= set_value(array('smsform', 'recipient'))?>" />
Problem
Form validation only works when I access every single value before the validation ran.
Any Ideas?