Home » Php » php – Launching a popup via in octobercms backend via javascript

php – Launching a popup via in octobercms backend via javascript

Posted by: admin February 25, 2020 Leave a comment

Questions:

Im trying to figure out how to launch a popup window with a relation widget in the backend using the Ajax framework for Octobercms.

The anchor provides a data-control='popup' option for creating a backend popups. The framework uses a jQuery method to call the backend $.request('onMethodName', { data: {id: id} });.

I’ve tried to add additional options for example $.request('onMethodname', { data: {id: tempMarker.id,control: 'popup' },control: 'popup',dataControl: 'popup' });

But with no luck. The documentation doesn’t say how to do it either. I’m attaching this to a click event for a map marker (img tag) in the backend, a popup should appear to edit the marker data.

How to&Answers:

This was simple as replacing the $.request('onSomething') with $.popup(handler: 'onSomething')

Found this thanks to https://octobertricks.com/tricks/update-records-from-list-view-in-a-popup