I just remembered that AS has a popup mode for add_new, which worked
exactly as I described, so I have added support for add_new with popup mode
in multiple associations.

You can use form_ui = :chosen, {add_new: {mode: :popup}}, or you can use
the short syntax, form_ui = :chosen, {add_new: true}, which will default to
popup mode for multiple associations.

It's supported for :select and :record_select on multiple associations too,
for any of the :select versions on collection associations (checkboxes,
draggable lists or select tag with multiple attribute).

Regards,
Sergio

El mar, 20 ene 2026 a las 22:37, Sergio Cambra (<[email protected]>)
escribió:

> Hi Gloufy
>
> I have tested chosen with add_new, in a belongs_to association, and I had
> to fixed it. It's in master branch, which I expect to release as 4.2.0 soon.
>
> However, using add_new with has_many association is not supported, either
> using :select or :chosen.
>
> The belongs_to or has_one associations support getting an ID to associate
> with an existing record, or a hash with fields from subform, saving a new
> record. So add_new just had to change between one UI or another, and the
> existing code saving the params would work.
>
> However, a has_many association expects an array of IDs, or an array of
> hashes. I don't think the code that parses the params to save the form
> would work with a mixed arrays of IDs and hashes. The easier way to support
> this would be adding a link to open a new tab or jQuery dialog, with the
> form to create a record, and then use JS to add the new record into the
> available choices (checkbox or option in a select). But there is no support
> for that yet.
>
> Regards,
> Sergio
>
> El jue, 1 ene 2026 a las 17:40, Gloufy (<[email protected]>)
> escribió:
>
>> hello Sergio !!! happy new year !! do you know how add new when multiple
>> associations ? in fact I just wand add record without refresh the page
>> (when I create it in a another page)
>>
>> Le mardi 26 août 2025 à 19:12:50 UTC+2, [email protected] a écrit :
>>
>>> I have just added support for :add_new with singular associations in
>>> :chosen,
>>> but I couldn't test it. I hope it works as in other form_ui, please test
>>> it
>>> and report any issue.
>>>
>>> Regards,
>>> Sergio
>>>
>>> El martes, 26 de agosto de 2025 16:41:39 (hora de verano de Europa
>>> central),
>>> Sergio Cambra escribió:
>>> > It should be posible yo add support for it
>>> >
>>> > El lun, 25 ago 2025, 22:19, Gloufy <[email protected]> escribió:
>>> > > Hi Sergio
>>> > >
>>> > > Do you think it's possible to use form_ui :chosen and :add_new ?
>>> > >
>>> > > Thanks for your response
>>> > >
>>> > > Gloufy
>>> > >
>>> > > --
>>> > > You received this message because you are subscribed to the Google
>>> Groups
>>> > > "ActiveScaffold : Ruby on Rails Gem" group.
>>> > > To unsubscribe from this group and stop receiving emails from it,
>>> send an
>>> > > email to [email protected].
>>> > > To view this discussion visit
>>> > >
>>> https://groups.google.com/d/msgid/activescaffold/73cbd7c1-1764-45ab-8d2d-5
>>> > > 29beb84207cn%40googlegroups.com
>>> > > <
>>> https://groups.google.com/d/msgid/activescaffold/73cbd7c1-1764-45ab-8d2d
>>> > > -529beb84207cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>>
>>>
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "ActiveScaffold : Ruby on Rails Gem" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion visit
>> https://groups.google.com/d/msgid/activescaffold/bc34171e-6e05-4aca-93bc-d1706da6dae3n%40googlegroups.com
>> <https://groups.google.com/d/msgid/activescaffold/bc34171e-6e05-4aca-93bc-d1706da6dae3n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/activescaffold/CAF2jUs_tYPCjPcOFQciC1udhkDW6K4rNTUOSjepo3Ug5BsFVPQ%40mail.gmail.com.

Reply via email to