Question

Hi I am developing a module and need a modal window to show a form with some input fields. The entered values should be passed back to the module settings.

What I specifically need is: In the module settings is a field with a button / link beside it which should open the popup. If the user saves the form from the popup the inserted data should be passed back.

What is the correct way to accomplish this feature.

Was it helpful?

Solution 2

Thanks your answer was partial useful.

For anybody who like to know how I achieved the modal window and pass back data from it to a main dialog:

I ended up using Fancybox (http://fancybox.net/) which is JQuery and way more flexiable than the Joomla default modal window.

The result can be found here:

  • general path to project: https://github.com/DHoffm/Responsive-color-google-map
  • JS: FancyBox can be found in the /js/fancybox folder and JQuery Click Handling can be found in /js/responsive_map_admin.js
  • PHP: /includes/elements/geodata.php (the code for the modal window can be found at the bottom)

OTHER TIPS

I assume that you can create the form and catch the submitted values.

The module setting is store in "params" column in #_modules table (# is your table prefix). so you can select your module's data with a simple SELECT query, decode the string of "params" column to an object, the update the values, encode the object back to json and save it to database.

Note that you can create many versions of your module, so in #_modules table there could be many records of your module, you need to make sure you get the right one.

In your module's XML file, you should also add fields for submitted values, otherwise you can not read and edit the values when you edit your module.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top