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) } ) } }
Comments
Post a Comment