forms - One text input and a submit button in scala -


i'm looking solution accomplish same thing in similar question:

html forms java play framework 2

but in scala. there way this? have 1 text field , submit button. want value text field when pressing button , pass value backend code.

basically, set view & form same way in html forms java play framework 2, , put in controller.

object mycontroller extends controller {   case class submission(value: string)   val submissionform = form(     mapping(       "value" -> text     )(submission.apply)(submission.unapply)   )    def myaction = action { implicit request =>     submissionform.bindfromrequest().fold(       formwitherrors => {         // bad form, reshow view         ok("got bad form")       },       submission => {         // submitted form         ok("got " + submission.value)       }     )   } } 

play 2.1 forms documentation


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -