Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Can you trigger DOM to redraw in field level hooks?

default discord avatar
KasparTr2 years ago
1

I am facing a challenge, where the form fields should be refreshed after a relationship field is updated. The reason is that other fields are populated, using default values, based on the relationship field selection.



Is it possible to refresh the DOM in field level hooks or is there a better methods to ensure reactivity?

  • discord user avatar
    jesschow
    2 years ago

    Hi @KasparTr - are you using hooks or conditional logic to populate the other fields? I'm thinking you could use an

    afterChange

    hook on the relationship field, and call your functions to populate the other fields within this hook.

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.