Like what we’re doing? Star us on GitHub!

Can you trigger DOM to redraw in field level hooks?

KasparTr
last month
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?

  • jesschow
    Payload Team
    2 weeks 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.

Open the post
Continue the discussion in Discord
Can't find what you're looking for?
Get help straight from the Payload team with an Enterprise License.Learn More