As a native via AJAX update form fields for the pivot-model in OctoberCMS (manage step)?

Comrades, the Octobrists, help, please.
Here's a page in the admin panel (model Route + the pivots for the City and Sight)


Everything is fine, when click Add Sight - offers a list of available Sight, click on one, go to the configuring additional fields Pivot table.


nothing clever but render the button from the widget, I came up with:
Here it is connected to plugins/xdim/tripmagik/models/routesightpivot/fields.yaml

 label: Order
 type: number
 span: auto
 label: Time from the start to the sight
 type: number
 span: auto
 label: Add time
 type: number
 span: auto
 label: Basic add. price
 type: number
 span: auto
 label: Default stay time
 type: number
 span: auto
 label: Min. stay time
 type: number
 span: auto
 label: Price per quarter of hour
 type: number
 span: auto
 label: You may try to get data from Google Maps API
 type: gmapsroutesightsync
 commentAbove: Make sure you have entered a Google Maps API key

I can assign the button an ajax handler, but here begins the most obscure: in the handler in the controller or the widget get such data from the POST:


Can izvratitsya, to generate the desired data on the basis of available, post back and already in the admin trivial js code to update the field values. But I have a feeling that it's not native and costalism some.
June 10th 19 at 16:33
2 answers
June 10th 19 at 16:35
As a native via AJAX update form fields

1. Make your handler on the server which will receive all you need to update the data
2. Contact native via AJAX to it, get data response
3. Print the data on the page

If any of these items is not clear, then formulate a question. CMS I'm not familiar with, so that can only help the known technology. Maybe someone will answer in more detail.
Thank you for taking the time.
What you describe is a common workflow, is already in OctoberCMS ajax framework, the mechanism of behaviors and handlers, but it is unclear how it correctly to connect in my case.
I would put only one tag OCTOBERCMS for the issue, but it does not exist, had a common set.
Yes, here you need experience for this CMS. Thanks again. - gerald.Vandervort4 commented on June 10th 19 at 16:38
well , in October, unlike Lara, you only need to separate the components (which are responsible for the public part) and the controller (admin). Depending on where the work is determined by the location of the handler. The rest - as written... - chelsea13 commented on June 10th 19 at 16:41
unfortunately, not for that. I like the unseen this CMS, it would be easier and faster to implement the desired functionality manually.
But, as I see it, the experts it is not found, alas. - rhianna_Fee commented on June 10th 19 at 16:44
June 10th 19 at 16:37
do not quite understand the task.
why there is update data in a form, and so if they are displayed when you open the modal with the form.
If you are interested in the case, he's next.
Some information is optional to fill out by hand, they can count on backend and paste into this form. - gerald.Vandervort4 commented on June 10th 19 at 16:40
Copy the file
test of course vary on your...
next, add buttons and so on...
handler is more difficult to
there is a method
 * Provides an opportunity to manipulate the pivot widget.
 * @param Backend\Classes\WidgetBase $widget
 * @param string $field
 * @param October\Rain\Database\Model $model
 public function relationExtendPivotWidget($widget, $field, $model)

but how to work with it I don't know...

there is a second method using the dependency fields to try to implement change other fields depending on one. - chelsea13 commented on June 10th 19 at 16:43
so I recommend to watch this video
just about backend relationship
here is the working plugin on it studied relationships in the backend - rhianna_Fee commented on June 10th 19 at 16:46

Find more questions by tags CMSAJAXPHPOctoberCMS