• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Repopulating Arrays of checkboxes

I've looked through the forums and other than modifying certain core files there seems to be no fix that is up to date ... meaning I haven't found one that wasn't over 2 years old. I have an array of check boxes representing towns a person could work in ... example ...

<INPUT TYPE=CHECKBOX NAME="coverage_areas[]" value="Cape Cod"<?php echo set_checkbox('coverage_areas[]', 'Cape Cod');?>/>Cape Cod

<INPUT TYPE=CHECKBOX NAME="coverage_areas[]" value="Boston"<?php echo set_checkbox('coverage_areas[]', 'Boston');?>/>Boston

<INPUT TYPE=CHECKBOX NAME="coverage_areas[]" value="Providence"<?php echo set_checkbox('coverage_areas[]', 'Providence');?>/>Providence

the only validation id do on this is the

$this->form_validation->set_rules('coverage_areas', 'Coverage Areas', 'required);

when the form is submitted and an error occurs the check boxes that were checked are not repopulated ... anyone got any ideas, as I said I've pretty much tried everything I came across.

I solved it ... just an oversite ....

it was my validayion call ...

$this->form_validation->set_rules(‘coverage_areas’, ‘Coverage Areas’, ‘required);

should be ...

$this->form_validation->set_rules(‘coverage_areas[]’, ‘Coverage Areas’, ‘required);

array !!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.