agiletoolkit reload a field of a CRUD form

224 Views Asked by At

I have a crud form that i want to autocomplete some fields(not all) with datas in my database. I don't want to reload all the form because of a pop-up (changes will be lost). When i try to reload a simple field like this. $myfield = $crud->form->getElement('myfield'); and doing after $myfield->js()reload() on an event. There is a new form inside myfield with all fields inside the subform.

My question is is it possible to reload the field independtly of the crud form and how to do it correctly?

1

There are 1 best solutions below

0
On BEST ANSWER

Try this. Let me know if something is not clear.

$form->js()->atk4_form(
         'reloadField',
         'field_name',
         array($this->api->url(),'some_other_var'=>'some_other_var_value')
)
  • field_name - name of your field to reload
  • some_other_var - aditional vars to be added to url

more about reloadField js function here