score:-1

Few points to note:

  • Put your case class Userdata outside the Application controller. That is move it inside controller package.
  • Also you can add @import at the beginning of your template, to import any arbitrary package or class.

Try this.

Application.scala: only one Userdata case class definition ( you had two of these classes defined )

import play.api._
import play.api.mvc._
import play.api.data._
import play.api.data.Forms._
import play.api.mvc.Request
import views.html._

case class Userdata(email:String, password:String)

object Application extends Controller {

  val userForm = Form(
  mapping(
    "email" -> text,
    "password" -> text
  )(Userdata.apply)(Userdata.unapply)
)

   def usercheck = Action{ implicit request=>

    userForm.bindFromRequest.fold(
      formWithErrors => BadRequest(views.html.login(formWithErrors)),
         Userdata => {  Ok(views.html.index("congrates"))}

    )}
    def index() = Action {
    implicit request=>
    Ok(views.html.login(userForm))
  }

login.scala.html: use Userdata instead of (String, String)

@(form: Form[Userdata])
@import helper._

    @form(routes.Application.usercheck){
    <form class=frmuuser>
      <input type=text placeholder=email id='emailid'>
      <input type=password placeholder=password id='pwd'>
      <input type=submit value=login id='enter'>

    </form>
    }

Related Query

More Query from same tag