![]() |
Validation set_radio Function for Editing - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Validation set_radio Function for Editing (/showthread.php?tid=12064) |
Validation set_radio Function for Editing - El Forum - 10-03-2008 [eluser]axpen[/eluser] I just had an interesting problem with page editing. I was trying to use the validation field repopulate methodology to re pick my radio button. Come to find out $this->Validation->set_radio and set_checkbox assert that the validation variable be a POST variable as well. This is what it's for, for repopulating fields. However it is also inevitably going to be used for edit, as it's the best way. I was looking for the best way to do this, so I checked bambooInvoice for an example. Code: <input style="width: auto;" class="requiredfield" name="save_invoices" type="checkbox" id="save_invoices" size="20" value="y" <?php I do my code a little different. I pulled the relevant data from the database before loading the view. So loading a record again would be a waste when the validation already has the data. It is just that set_radio's explicit looking in POST is keeping it from working. I was thinking the set_radio and checkbox could go from; Code: function set_radio($field = '', $value = '') to; Code: function set_radio($field = '', $value = '', $variable = '') I am still quite new to CodeIgniter, so please correct me if I am on the wrong track. Or point me to how this should be done or why my idea wouldn't work. Thanks, --Alex |