Hi,
Created a products module, which is an advnace module, but now i need to have a link to delete a certain uploaded PDF and trying to create normal controllers, and models as you would with a standalone version of Codeigniter, i find this doesn't work, so what should I do?
Comments
Can you be a little more specific about what doesn't work? Examples of what you have now would be helpful.
So I need to grab the ID of the product and then tell it to delete a certain row from the database.
Can you screen shot the form?
Just trying to understand why the normal delete for a form doesn't work for you. It's purpose is to delete rows from the database..
You could include a checkbox in the after_html form field.
Then check for it's existence in $this->normalized_save_data (or plain old $_POST) in the models on_before_save() hook. If there, unset your pdf field and save.
see image -> http://imageshack.us/photo/my-images/546/screenshot20120426at120.png/ see the delete text so when this delete link is clicked is need to remove that pdf from the database but leave everything else as is
I figure you're meaning from the list items. That will be much trickier.
I don't think an extra url component will get it done for you. I think you're best bet is to have a look at the create_function() call in /modules/fuel/config/fuel_modules.php in the users config array.
I've not had to do one of those yet so can't be of too much help. I'd say you'll need a custom controller to catch it too.
Hopefully Dave can offer you some better advice.
http://www.getfuelcms.com/forums/discussion/comment/2138/#Comment_2138
The module method can be examined in the fuel/modules/fuel/controllers/module.php file
http://pastebin.com/Jm8jeF9X
$(function(){ if ($('.my_delete').click(function(e)){ $('#delete_pdf').val('1'); $('#form').submit(); } });
Then in the model, you could use an on_after_save hook to detect the value of "delete_pdf" and put code in your hook to delete it.
function on_after_save($values) { if (isset($this->normalized_save_data['delete_pdf'])) { .... delete code... } }