Good Morning, I have a Form and i want too submit it with two buttons each one of them do the submit and redirect me to another page, How can i do that with play Framework ?? Thanks
in your template do
#{form @nameOfTheController.nameOfTheAction()}
... some stuff
<input type='submit' name='action1' value="Submit button 1" />
<input type='submit' name='action2' value="Submit button 2" />
#{/form}
and in your controller with the action
public static void nameOfTheAction(String action1, String action2)
{
if(action1 != null)
{
// do logic that should happen when button 1 is pressed
}
else if (action2 != null)
{
// do logic that should happen when button 2 is pressed
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With