Polymorphic_embed - polymorphic Embeds in Ecto

You just need to manipulate the type field in the polymorphic field (by default __type__).

So, given a “type” field (of type string) you could try something along this for example:

<.input field={@form[:type]} type="select" label="Select type" name={@form[:my_polymorphic_field].name <> "[__type__]"}
          options={[{:sms, :sms}, {:email, :email}]} prompt="" />