1
votes

I am rendering a SignUp form. Below is my code of Register.java and SignUp.java

controllers/Register.java :

package controllers;

import models.SignUp;
import play.mvc.*;
import play.data.Form;

public class Register extends Controller{
   final static Form<SignUp> signupform = form(SignUp.class);

   public Result index(){
     return ok(index.render(signupform));
   }

   public  Result submit(){
     Form<SignUp> filledform = signupform.bindFromRequest();
     SignUp details = filledform.get();
     return ok("validated");
   }
}

models/Signup.java:

package models;

public class SignUp{
   public String firstName;
   public String lastName;
   public String emailId;
   public String password;
   public String address;
}

But I am getting the below error :

cannot find symbol 
symbol: method form(java.lang.Class<models.SignUp>) 
location: class controllers.Register

Could some one help me find out why the above error appears despite the import of play.data.Form.

Thanks in advance.

1

1 Answers

0
votes

The method form you are using, it's from class play.data.FormFactory.

You should have an instance of FormFactory to get a Form instance.

For reference Play docs