Ash FrameworkAF
Ash Framework6mo ago
11 replies
Fugi

Server-side params for AshPhoenix Form

Sometimes I will have an AshPhoenix form to create or update a resource, and I want some of the fields to be provided from the server and not set or visible on the client. Sometimes these are coming from uploads, other times it's computed from other state.

What is the best way to provide this data to validate and submit? So far I've been defining a form_params(socket, params) helper that injects/overrides various params before passing the result to validate/submit. This has worked OK but feels wrong, and today I ran into an issue of having to reverse-engineer how AshPhoenix expects unions to work.

Appreciate any insight and guidance y'all can provide!
Was this page helpful?