Possible to update multiple targets each with content from different src's ?

44 views
Skip to first unread message

Mark Nellemann

unread,
Dec 12, 2018, 5:37:32 AM12/12/18
to intercooler-js
Hi,

I have a button that ic-post-to my backend including values from a html-select and html-input to my backend.
The backend returns updated html and the target (a tbody) is updated as supposed.

But, at the same time I also want to update the html-select, as the option submitted should not be available anymore.

Any ideas how to go about that ?


Br,
Mark

Oliver Wittwer

unread,
Dec 12, 2018, 5:55:20 AM12/12/18
to Mark Nellemann, intercooler-js
Hi 

Use ic-deps (http://intercoolerjs.org/attributes/ic-deps.html) on the select element. 

E.g. you have <button ic-post-to="/post_form" ... />

Then you can add <select ... ic-get-from="/update_select" ic-deps="/post_form" ... />

When the button is clicked the select will issue a request to "/update_select". The update_select script then has to serve the actualized select with new content. 

Hope this helps. 

Regards,
Oliver

------ Originalnachricht ------
Von: "Mark Nellemann" <mark.ne...@gmail.com>
An: "intercooler-js" <interco...@googlegroups.com>
Gesendet: 12.12.2018 11:37:31
Betreff: Possible to update multiple targets each with content from different src's ?

--
You received this message because you are subscribed to the Google Groups "intercooler-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to intercooler-j...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anders Baumann

unread,
Dec 12, 2018, 6:19:19 AM12/12/18
to intercooler-js
Alternative you could change the target to a parent element that includes all the elements that needs to be updated.

/Anders

Mark Nellemann

unread,
Dec 12, 2018, 12:15:30 PM12/12/18
to Oliver Wittwer, intercooler-js
Hi Oliver,

Perfect - works just as I needed.


Thanks a lot!

Mark
Reply all
Reply to author
Forward
0 new messages