我有编辑订单的表格,但我必须添加删除订单的按钮。现在我有两个提交按钮的表单:
@helper.form(routes.Order.editOrder,'class -> "form-horizontal") {
@helper.inputText(
PlayMagicForJava.javaFieldtoScalaField(editOrderForm("date")),
'_label -> "Date:",
'_help -> ""
)
@helper.inputText(
PlayMagicForJava.javaFieldtoScalaField(editOrderForm("place_from")),
'_label -> "From:",
'_help -> ""
)
<button type="submit" name="edit" id="edit" class="btn btn-primary">Edit Order</button>
<button type="submit" name="remove" id="remove" value="remove" class="btn">Remove order</button>
}
我在控制器中的功能仅用于编辑:
public static Result editOrder(){
Order user = User.findByEmail(session("email"));
Form<Order> editOrderFormFilled = editOrderForm.bindFromRequest();
Order order = Order.findByID(editOrderFormFilled.get().id);
if(editOrderFormFilled.hasErrors()) {
return badRequest();
}
else if(user.id != order.created_by){
return badRequest();
}else{
return OK();
}
}
如何处理提交的按钮?