Insert relational data in lookup table
Hello,
Here I'm with my second question
This time I am managing to construct a form 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 to 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
Figure 1Figure 2
Comments
http://www.getfuelcms.com/user_guide/javascript/jqx
Each simple module inherits from the BaseFuelController that has an "editModule" method that can be accessed from outside the controller by other scripts with page.editModule(url, callback). This method is what is used to create that popup window. The variable 'page' is the name of the jqx global controller variable that gets assigned on a page. Let me know if that makes sense.
I have been looking into the things you told me, but i was not able to figure out a good way to achieve my aim, may I abuse a bit of your kindness and ask you to give me more detailed insight in how to achieve my aim?
Thanks a lot
$('#hitos").bind('selectionAdded', function(e, vals){ console.log(vals); //write your own code here to manage the popup and submission of that form })
I just posted an update to trigger the events 'selectionAdded' and 'selectionRemoved' and so you will need to download the latest fuel/modules/fuel/assets/js/jquery/plugins/jquery.supercomboselect.js. The newly added triggers returns an array of the values being added and removed as the second parameter in your bind function (see above). For what you need though, it may be tricky since you can add more then one at a time with this widget.