Client side confirmation before handling phx_change

Hello

I have a live view that has:

<%= f = form_for :action, "#", [phx_change: :action] %>                 
  <%= select f, "#{id}", ["-", "Delete"], selected: "-", class: "action" %>
</form>

Is it possible to make a client side confirmation (e.g. window.confirm), when client selects “Delete” value? Based on result from that confirmation, handle the phx_change action or not (e.g. it will not be delivered if confirmation returned false) on the server side?

Is there a reason for this to be a select and not a button? For buttons (and links, …) there’s data: [confirm: "text"], which triggers on click.

Yes, I know about that, and in general about data-confirm. But in this case, I want to have s select element with options.

You could maybe use a hook, but what we’ve done in such cases is do an actual confirmation modal that we build with live view.