0

Hi I have just started learning Play Framework 2. Is it possible to not specify any action in the parameter of @helper.form in the scala template. Something like:

@helper.form()

instead of

@helper.form(action=@routes.Apllication.create) 

I want to make an Ajax call when a user presses enter in a form, rather than calling an action.

David
  • 4,744
  • 5
  • 33
  • 64
custosat
  • 99
  • 8

1 Answers1

0

@helper.form(action){...} just generates HTML's <form> tag with proper action and method attributes basing on the routes defined.

That means, that you can just write the code yourself instead of using the helper.

<form id="myAjaxDrivenForm">
   <input type="text" name="foo" />
</form>
biesior
  • 55,576
  • 10
  • 125
  • 182
  • Of course you should take HTML specification into account about `action` attribute: http://stackoverflow.com/a/9401608/1066240 – biesior Jan 28 '15 at 12:28