moCap
moCap

Reputation: 969

Scala Form, Type mismatch error

I am trying to do CRUD on a Category class:

categoryEdit.scala.html:

@(cat: Category, myForm: Form[Category])    
@admin(title = "Category") {
  @helper.form(action = controllers.Application.categorySave) {        
    @inputText(myForm("name"))

    <input type="submit" value="Save">
  }
}

The controller code:

public static Result categorySave() {
    // save form data here ...
   return redirect(
      routes.Application.index()
  );
}

Entry in Routes file is as below.

GET   /saveCategory        controllers.Application.categorySave()

I am getting this error:

type mismatch; found : play.mvc.Result required: play.api.mvc.Call

on this line: @helper.form(action = controllers.Application.categorySave) {

What's wrong in my form? I am missing something?

Upvotes: 1

Views: 2513

Answers (1)

i.am.michiel
i.am.michiel

Reputation: 10404

How about changing your action?

controllers.routes.Application.categorySave

PS : Mind the routes in the route.

Upvotes: 3

Related Questions