I have a form that has 3 inputs that are all defined in a schema (Event), use the helper functions like the liveview generator outputs and are validated via a handle_event “validate” function via a single changeset.
For creating a new Event in addition to these 3 inputs defined in the schema I would like to include an addition input field that allows users to enter an area code, which I would like to be able to validate (3 numbers, certain ones are valid, etc) and then pass to the create_event function in my context.
So far by making an input field I am able to capture an entered area code and throw the entered code into the event_params to then be passed into the create_event function. However by doing this the input field isnt being validated like the other 3 inputs.
I am still pretty new to liveview, points in terms of how to accomplish this would be helpful. I was playing around with making area_code a virtual attribute in the Event schema so I can add a changeset and do it as part of the form (now all 4 inputs are connected to 1 schema), does that seem like the right direction?