wire-elements/modal

How to open additional modal from modal?

stojankukrika opened this issue · 7 comments

Hi,
How to open modal from modal and close parent modal? Or How to close current modal and open new one.

My scenario is: user click on generate some token, and I like to show him a new token in new modal because I do not want to show token in the past, just that time it will shows up and will be masked in future. To prevent hackers to use it again in some other places.

Is that possible?

Best regards and thank you fro this package, it's AWESOME!

Krato commented

@PhiloNL After upgrade to v2 using Livewire 3, this is not working. Can you check it please?

Thank you!

Example: If you call from Livewire component that already is a modal:

$this->dispatch('openModal', component: 'my-awesome-second-modal');

First modal is hide, but second is not showing. Is giving a js error:

Uncaught TypeError: Cannot read properties of null (reading 'before')  at Block.appendChild (livewire.esm.js:5392:25)
GBry commented

Having the same error. The thing is, it's not happening on every modal, another one where I implemented a two step modal works.

Can you give this a try in the latest release? Thanks!

If this still occurs, let me know.

Can you give this a try in the latest release? Thanks!

Hi, I encountered the same problem like the author stated. First modal went to hide but second one is not showing and gave the same js error. Uncaught TypeError: Cannot read properties of null (reading 'before').

ggg

@fkhrdinn try changing inject_morph_markers => false in livewire.php. This fixed my error, which only happens in production.

FWIW livewire/livewire#6965

GBry commented

@PhiloNL Haven't been happening since, happens just now. Weirdly enough, it's a whole different modal and child-modal. I can confirm that the child-modal works when not spawning from a parent modal (standalone)

@camerontucker your suggestion... didn't work. After changing that, and reclearing config and cache, no change.