spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

type mismatch; found : play.api.data.Form[controllers.Application.Userdata] required: play.api.data.Form[(String, String)]


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>
    }

Categories : Scala

Related to : type mismatch; found : play.api.data.Form[controllers.Application.Userdata] required: play.api.data.Form[(String, String)]
'string' does not contain a definition for 'Fill' and no extension method 'Fill' accepting a first argument of type 'string' could be found
String da = ConfigurationManager .ConnectionStrings["connectionString"].ConnectionString; da.Fill(dtparts); You're trying to call the Fill method on a String object, when you want a DataAdapter object. Here is another example that has code for what you may be trying to do. Populating a DataSet from a DataAdapter

Categories : C#
how to import json string constants from outside module to angularjs controllers?
You can create a module that holds constants and is included in your js build process and use $provide.constant('constantName', constantObj); to provide the value. then you can just import the module and then the provider in your controller by doing: app.module('this.aController', ['constantsModule']); app.controller('aController', [ 'constantName', '$scope', function ($scope) { console

Categories : Angularjs
Separating input string and call the required function using case statement
First import Data.List, which has all the list manipulation functions. Then to split at the first space, use span. Then drop the first element of the second half of the list, since that will be the space. The code is then: import Data.List f :: String -> (String, String) f s = (func, tail args) where (func, args) = span (/=' ') s EDIT: Oh yeah, for the second part of your question. You're

Categories : Haskell
Why String created using new operator creates string literal in string pool
First, I recommend that you not use new String("abc") because it behaves as you described. Second, when you use new you should expect a new Object instance will be created and it is.

Categories : Java
Trying to add linebreaks to every found pattern in string
Assuming that you don't have any separator you can use the '.edu' as a separator because you know that It will be founded in any email you have, so you can try something like this: JS var str = 'mail1@mail1.edumail2@mail2.edumail3@mail.edumail4@mail4.edumail5@mail5.edu'; var emails = str.split('.edu'); var result = document.getElementById('result'); for(var i = 0, len = emails.length; i < l

Categories : Javascript
Recently Add
head :: tail pattern matching for strings
What is the easiest and most efficient way to make a min heap in Scala?
Removing mutable collections and making it look more scala style
Reverse list of n elements
scalac: Error: object CharRef in intelliJ 14
Scala - trouble with type inference in lambda expression
Exception on spark test
How can I emulate Haskell's typeclasses in Scala?
Slick: CRUD extension: How to encapsulate implicit mapping:BaseColumnType[T]
Can't find Traverse for sequencing Seq[ValidationNel[String, MyCaseClass]] => ValidationNel[String, Seq[MyCaseClass]]
Tail recursion: internal "loop" function or default values for accumulators
Scala - Add element:MyType to Array = option[MyType] expected
Scala, Composing Function with two values
Using dependent type to generate compile error
How to match all words in a sentence with scala combinators?
Parser Alternative Operator | Fails
ScalaTest assertion mismatch due to Physical Address
Scala implicit parameter and japanese smiley 'foldLeft'
Is it possible to user reduceByKey((x, y, z) => ...)?
How to implement security Authorization using scala and play?
SSO login using scala script
Sum elements based on a predicate
Keep track of completed Futures
API Observable with dynamic caching
java.io.IOException: Remotely closed in gatling
Scala permutations using two lists
Is Scala Either really a Monad
Spark: Use of distinct
Identifying two type wildcards as identical
how to package spark scala application
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.