Home > OS >  Reinitialize autocomplete after form submission
Reinitialize autocomplete after form submission

Time:12-26

I have a custom enter image description here

Question: how do I provide the input with data about the item label?

I expected the it to have something like reverse_autocomplete_url that would be called after input initialization to get items by their IDs but I don't think there is such an option.

CodePudding user response:

Considering you used symfony form.

You used $form->isValid() etc..

Persisted and flush your object.

Then instead of re-rendering the twig, call redirectToRoute function to the current route.

If you provide more detail about your usecase i can give you a better answer.

CodePudding user response:

You have to initialize the form field with options array:

'tom_select_options' => [
    'options' => [
        [
            'value' => 15,
            'text' => 'Foo',
        ],
    ],
],

value and text keys are customizable via valueField and labelField properties.

  • Related