Hi! I have a LiveView app with a form that contains an arbitrary number of fields I want the user to be able to add on the fly–there’s at first one field and then they can add as many more as they’d like by clicking a button. What I think I need to do is wire up the button so that the LiveView server inserts a new div in the page for this field and also calls a javascript function which implements some logic around mutually-exclusive field values (using some EventListeners).
Is there a recommended way to do this? One constraint I have is that my content security policy disallows inline event handlers like onClick so getting the javascript function triggered is tripping me up at the moment. I was thinking the insertion of a new div could be handled by a Phoenix function component, but I just want to make sure it’s okay to use it this way.