Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Form Submit with playframework [closed]

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

like image 359
SaBri BouHaddi Avatar asked Jul 21 '26 00:07

SaBri BouHaddi


1 Answers

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
  } 

} 
like image 55
Dominik Dorn Avatar answered Jul 23 '26 05:07

Dominik Dorn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!