Multi-button voting form - best approach?

I’ve got a project that is using Phoenix 1.4. We’ve scaffolded up most of the essential actions and paths. We’re running into a hurdle on the best way to come at a voting form.

Essentially, this project is one where potential participants in an upcoming event submit applications to be approved. A judging committee views the applications and on each application page as designed there are two buttons to allow for a “yes” or “no” vote on the application. The vote action would need to carry an application id, a judge id, an event id and the actual boolean vote value. No submit button. The “yes” or “no” fires the submit action.

I’ve not found a native Phoenix approach to this, through if one exists, it would be ideal. This looks like a good fit for Drab, but it’s not yet 1.4-compatible from what I’ve seen so far.

Does this need an Ajax or even a Vue workaround to make it happen?

HTML buttons can have a value property, so you can just use that and process it like you would any other field.

<button name="approve" type="submit" value="yes">Yes</button>
<button name="approve" type="submit" value="no">No</button>

Or just name the buttons different names and test one or the other. :slight_smile: