mardi 31 janvier 2017

How to add a parameter to a submit action in Ember?

I have a form with an action defined on submit. I would like to have two buttons that submit the form with a parameter. Here is an example:

<form >
    <input type="text">
    ....
    ....
    <button type="submit">Do Stuff</button>
    <button type="submit">Do Stuff and Other Stuff</button>
</form>

doStuff(doOtherStuff=false){
    //do stuff
    if(doOtherStuff){
        //do other stuff
    }
}

I know I can define two actions on the buttons like this :

<button type="submit" >Do Stuff</button>
<button type="submit" >Do Stuff and Other Stuff</button>

But I would like to befit from the form submission (HTML validation, etc)

Is this something possible, or am I missing something big ?

Thanks!




Aucun commentaire:

Enregistrer un commentaire