0

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?

  • Could you post what you've attempted so far? – jrd1 Oct 15 '12 at 08:45
  • i try to load values from a database to auto fill the form when a id is selected. it is working fine but the form must be reloaded to set the values in the fields. but i want to reload only the concerned fields not all the form. – herizo Ludovic Oct 20 '12 at 11:27
  • I finally find another way using directly ajaxec to send the request and update the content of the fields with javascrip. thanks – herizo Ludovic Nov 10 '12 at 07:33

1 Answers1

0

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

Vadym
  • 749
  • 3
  • 15