score:0
user.scala.html:
@(userform: form[userdata]) (implicit messages: messages)
@helper.form(action = routes.usercontroller.userpost()) {
@helper.inputtext(userform("name"))
@helper.inputtext(userform("age"))
}
usercontroller.scala:
package controllers
import play.api.mvc._
import play.api.play.current
import play.api.data._
import play.api.data.forms._
import javax.inject.inject
import play.api.i18n.i18nsupport
import play.api.i18n.messagesapi
import play.api.i18n.messages.implicits._
import views._
case class userdata(name: string, age: int)
class usercontroller @inject()(val messagesapi: messagesapi) extends controller with i18nsupport {
val userform = form(
mapping(
"name" -> text,
"age" -> number
)(userdata.apply)(userdata.unapply)
)
def index = action {implicit request =>
ok(views.html.user(userform))
}
def userpost = action {implicit request =>
userform.bindfromrequest.fold(
formwitherrors => {
// binding failure, you retrieve the form containing errors:
badrequest(views.html.user(formwitherrors))
},
userdata => {
/* binding success, you get the actual value. */
val name = userdata.name
val age = userdata.age
ok(<message>success !!</message>)
}
)
}
}
score:0
everything looks good, except perhaps the space between:
@(userform: form[userdata]) (implicit messages: messages)
try:
@(userform: form[userdata])(implicit messages: messages)
since it's supposed to be a grouped parameter
Source: stackoverflow.com
Related Query
- Play 2.4: Form: could not find implicit value for parameter messages: play.api.i18n.Messages
- Scala, Play Framework Slick issue - could not find implicit value for parameter rconv
- Play 2.5 Migration Error: Custom Action with BodyParser: could not find implicit value for parameter mat: akka.stream.Materializer
- Play 2.5 with Akka - could not find implicit value for parameter timeout: akka.util.Timeout
- Play Framework 2.2 - could not find implicit value for parameter timeout
- Could not find implicit value for parameter messages
- could not find implicit value for parameter c: anorm.Column[Float] Play Framework Scala
- Play 2.5: could not find implicit value for parameter messages: play.api.i18n.Messages
- could not find implicit value for evidence parameter of type org.apache.flink.api.common.typeinfo.TypeInformation[...]
- Could not find implicit value for evidence parameter of type scala.reflect.ClassManifest[T]
- Could not find implicit value for parameter flash
- scalaz List[StateT].sequence - could not find implicit value for parameter n: scalaz.Applicative
- spray-json error: could not find implicit value for parameter um
- could not find implicit value for parameter e
- could not find implicit value for parameter system: akka.actor.ActorSystem
- saveTocassandra could not find implicit value for parameter rwf
- could not find implicit value for evidence parameter of type scalaz.Applicative
- Running scalaz-stream's Process gives could not find implicit value for parameter C: scalaz.Catchable[F2]?
- Could not find implicit value for parameter lgen: shapeless.LabelledGeneric.Aux
- Slick error while compiling table definitions: could not find implicit value for parameter tm
- akka-http : could not find implicit value for parameter unmarshalling
- Scala error Could not find implicit value for parameter
- could not find implicit value for parameter encoder: io.circe.Encoder[com.sweetsoft.SapHealth]
- could not find implicit value for evidence parameter of type ^
- Scala, Type could not find implicit value for parameter n
- Slick: could not find implicit value for parameter e: slick.jdbc.SetParameter[Option[java.util.UUID]]
- Scodec - Coproducts could not find implicit value for parameter auto: scodec.codecs.CoproductBuilderAuto
- could not find implicit value for parameter semigroupal
- could not find implicit value for evidence parameter
- could not find implicit value for evidence parameter of type Ordered[T]
More Query from same tag
- How can I run ScalaTest suites in a single thread?
- Play Validation - Custom form field validation with specific field error
- Is it possible to pass multiple type parameters to implicitly as in implicitly[Monoid[A[B]].mappend?
- Is there a coding standards enforcement tool for Scala?
- Apache Kafka: KafkaProducerActor throws exception ASk timeout.
- Scala script creating DF and temp tables in spark shell - issues
- Spark Streaming | Write different data frames to multiple tables in parallel
- Call function outside inner object with same name?
- In Play 2.2, Spec2 tests, I get Configuration error[Cannot connect to database [default]]
- How can I incorporate Scala program into web page
- How to remove unwanted rows in dataframe based on a list of items or descriptions
- Conditional concatenation of iterator elements - A Scala idiomatic solution
- Reading large number of bytes from GZIPInputStream
- Adding headers in a Spray.io Test Spec fails to send the request into the route
- 'Happens before' on Scala constructors: final fields
- replace null value in the column of a dataframe with the value in other dataframe wrt to id
- Group by column "grp" and compress DataFrame - (take last not null value for each column ordering by column "ord")
- How to build processing in Scala depending on the multiple future Completion
- Context bounds with two generic parameters
- Solving type erasure problems with an abstract type in a trait
- Overwrite in to same partition files after transformation based on the filename using spark
- How can I apply a transformation to all elements in a json array while collecting the validation errors?
- (java.lang.IllegalArgumentException: protocol = http host = null) In example play project (Scala)
- How to subtract DataFrames using subset of columns in Apache Spark
- Implicit conversion in monadic for comprehension in Scala
- How to send input file name to args:Array[String] from a script in Scala?
- AWS Lambda return a file
- Spark SQL sum rows with the same key and appending the sum value
- How to convert a `Stream` into imperative read operations
- Spark Kryo: Register a custom serializer