Unpoly v2 closing a modal layer after a form submission in php

138 views
Skip to first unread message

ncc...@gmail.com

unread,
May 10, 2021, 6:26:10 PM5/10/21
to unpoly
I'm testing out v2, like what I see so far, but I can't figure out how to get the modal layer to close after a successful add/edit post is performed. I want the modal layer to close and be able to refresh the underlying displayed list. Only example I see in the docs is related to rails - seems php examples would really be useful.

adam.me...@gmail.com

unread,
May 10, 2021, 7:50:47 PM5/10/21
to unpoly
What do you have so far? and what have you tried?

Henning Koch

unread,
May 11, 2021, 6:19:14 AM5/11/21
to unp...@googlegroups.com
Hi,

documentation for closing overlays in Unpoly 2 is here:
https://v2.unpoly.com/closing-overlays

If you would like to contribute PHP examples somewhere, there is an
"Edit this page" button at the top right of every documentation entry.

Best regards
Henning
> --
> You received this message because you are subscribed to the Google
> Groups "unpoly" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to unpoly+un...@googlegroups.com
> <mailto:unpoly+un...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/unpoly/a513db87-7b20-4dae-8593-df0f44e67a6en%40googlegroups.com
> <https://groups.google.com/d/msgid/unpoly/a513db87-7b20-4dae-8593-df0f44e67a6en%40googlegroups.com?utm_medium=email&utm_source=footer>.

Jim Santarius

unread,
May 11, 2021, 9:44:11 AM5/11/21
to unp...@googlegroups.com
Great - that page had what I needed with the ability to send a header back to close the layer. Is there a way to trigger a refresh on a fragment that was loaded by a button click? What I have is a userlist that has edit links that open the modal layer allowing an edit for a user. When the layer is closed I need the list to refresh to reflect any changes.

To unsubscribe from this group and stop receiving emails from it, send an email to unpoly+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/unpoly/3a5279e3-c89f-fedc-e391-b604e652405b%40gmx.net.

adam.me...@gmail.com

unread,
May 11, 2021, 11:02:19 AM5/11/21
to unpoly
>  Is there a way to trigger a refresh on a fragment that was loaded by a button click?

Can you target the element using up.reload? `up.reload('.some_selector')`

I believe it should know where it was loaded from via `up-source`, but maybe I'm wrong and Henning can correct me.

> When the layer is closed I need the list to refresh to reflect any changes.

I feel this could be handled via `up-on-accepted` when you start the journey through the layer. Maybe paired with up.reload?

`<a href="/users/1/edit" up-mode="modal" up-on-accepted="up.reload('.user-details')">Edit</a>`

I've only started playing with Unpoly v2 so I'm not sure of all the intricacies yet.

Henning Koch

unread,
May 11, 2021, 11:26:26 AM5/11/21
to unp...@googlegroups.com
> I feel this could be handled via `up-on-accepted` when you start the
> journey through the layer. Maybe paired with up.reload?
>
> `<a href="/users/1/edit" up-mode="modal"
> up-on-accepted="up.reload('.user-details')">Edit</a>`

This is how I would do it.

Best regards
Henning
Reply all
Reply to author
Forward
0 new messages