开发者

Insert relational data in lookup table

I am managing to construct a form (with FuelCMS) that has a look-up table, and the look-up table has a field that must be inserted at the same time as the relation (Figure 1).

Using a model inside my module I have finished the form to insert the data, I have a control (Figure 2) to select the relation between the two tables, and here is where my question comes. I need t开发者_开发知识库o show a pop-up (like the one when you press the "ADD" or "EDIT" button that allow the user to insert the value of the "objetivo" field (Figure 1) at the time you assign "Hitos" to the "indicadores".

What is the best way to do this? Can I attach a JS file to the form from the module to be able to capture the button click and show the pop-up? There are another better way already to achieve that task?

I hope I made my point clear, if not, please tell me and I will try to explain myself better.

Thanks :)

Insert relational data in lookup table

Figure 1

Insert relational data in lookup table

Figure 2


Thanks to the kind of the FuelCMS team I was at the end able to solve the situation I explained before, to achive the aim you should follow the next steps:

  • Add a javascript file on the module config (fuel/modules/MODULE_NAME/config/MODULE_NAME_fuel_module.php)
  • Use the Javascript hooks 'selectionAdded' and 'selectionRemoved' to launch the popup (FuelCMS uses jqmodal as popup) the functions pass as a parameter an array "vals" that contains the ID of the selected items.
  • Add a AJAX request in the popup code to retrive the form
  • Process the form and keep the values for later saving on database or manipulatión.

It could be a bit tricky if you need a complex logic but is an effective way of do it :)

Once again TAHNKS to the FuelCMS support people, i hope this help someone.

Best regards.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜