CodeIgniter Forums
How can I pass a value through a modal popup? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: How can I pass a value through a modal popup? (/thread-61176.html)



How can I pass a value through a modal popup? - El Forum - 10-06-2014

[eluser]alexandervj[/eluser]
I'm trying to pass a value to a modal popup like this one...
http://www.codeproject.com/Articles/589445/JavaScript-Modal-Popup-Window
but not sure how to go about passing a value to a Javascript modal popup like this.

I'm trying to stay away from another browser window popping up - id rather the user have to close the window before being able to go onto different parts of the application, which is why I want to use a javascipt modal.

Have you ever done anything like this? Can you give me some insight as to how to go about it? Thanks


How can I pass a value through a modal popup? - El Forum - 10-06-2014

[eluser]CroNiX[/eluser]
What kind of value? Where's it coming from? Normally I'd put the value in the HTML, like an ID or data attribute, and then when the popup is supposed to open grab the value from the HTML. Or use ajax to retrieve the value...it really depends on where the value needs to come from, as well as the popup library. I use jQueryUI, so can't really help you with that particular modal you linked to.


How can I pass a value through a modal popup? - El Forum - 10-06-2014

[eluser]alexandervj[/eluser]
I have a table populated by a foreach statement that pulls values from a database. What Id like to do is have a click-able link from this table of values that will open a popup modal of details based on the item you click on.

Is there a way to do something like this with jQueryUI?

Thanks


How can I pass a value through a modal popup? - El Forum - 10-06-2014

[eluser]CroNiX[/eluser]
Sure. You'd just use the 'open' event for the modal, grab the value from the HTML and insert it in the dialog or something.
http://api.jqueryui.com/dialog/

Hard to tell exactly what you are trying to do without seeing code.