Inline editing of foreign keys
Hi
I was wondering how easy it is to implement inline editing of module forms via a popup. For example, I have a module with
public $foreign_keys = array('imageID' => array('app' => 'images_model', 'order' => 'imageName asc'));
On the edit page, this gives me a dropdown box with [edit] & [add] buttons. When I want to say, add a new option (for that dropdown), I click the button and I get a "create" page from the images_model.
How can get that "create" page to appear as a popup? It happens elsewhere, I'm not sure how that's implemented...
TIA
cheers
Comments
http://docs.getfuelcms.com/general/forms#inline_edit
I have some "copy" fields which are created manually in the module:
$str = '<div>/*my manually created content*/</div><a href="'.fuel_url('my_model/create').'" class="btn_field">Add</a>'; return array('type' => 'copy', 'tag'=>'div','value' => $str, 'order' => 10);
Is there way to get Fuel to do the popup for this "add" or do I need to code it manually with an extra 'js'=>'somejs();' parameter in my returned array?
<a href="'.fuel_url('my_model/create').'" class="btn_field add_edit">My Add Button</a>
Gives me extra buttons with undefined href attributes. eg.
[My Add Button] [Add] [Edit]
My Add Button still opens a new page, the Add & Edit attempt to open popups but have undefined hrefs.
<select class="add_edit" data-module="my_module" style="display: none"></select>
Also, as an FYI, the logic for the inline_edit javascript is found in the custom_fields.js file "fuel.fields.inline_edit_field" method if you need to create your own JS logic.
The
<select>
solution works but restricts the ability to pass URL parameters to the popup. For example, it's handy to pass the ID of the parent record.It seems the class "add_inline_button" is more useful here.
<a href="'.fuel_url('my_model/inline_create?imageID='.$values['imageID']).'" class="btn_field add_inline_button">My Add Button</a>
This was tested on Fuel 1.1...
$fields['my_field']['module'] = FALSE;