I am trying to create many custom fields
Use as a reference.
Then when I do, then magical This is my constructor using but how do I create many constructors, so I can create different input types like: > How do I implement it? p> First of all, For some time reading books and articles and loads of things about Scala, but some are barely coded). I am sorry for such a question, but scalar makes learning difficult to play, it seems that you need to master before Scala, so that you can consolidate play or understand how it is made. Documentation does not help a lot in these cases. Another way to do this is that in many fields a scale object (a separate file) And then import this object into your thoughts. The rest will be easy to follow. First: Create a scene for the field you want to create. Let's call it textinputgroup.scala.html This will contain the code Then: Create your object helper, let's call it bootstrap.scala and inside it, enter the field you want to create. (You can put textinput.scala.html in the same folder under bootstrap.scala and 'View' directory) And finally: Import and use this object in your thoughts. I use the Bootstrap (Multilevel Configurator) and the Semantic-UI (Semantic Formatter) framework To create many fields, there are some more examples in . See them. After creating MyHelpers
Object MyHelpers {//} Importing it to '.f' I at my
.scala.html / I> east>
@import MyHelpers._
@inputText (myForm ("username"))
MyHelpers
@inputText (myForm ("username")) @inputDate (myForm ("birth"))
@ (element: assistant filename, text: string) & lt; Div class = "form-group input-group if (@ elements.hasErrors) {error}" & gt; & Lt; Span class = "input-group-addon" & gt; @ Text & lt; / Span & gt; @ Elements.input & lt; Span class = "errors" & gt; @ Elements.errors.mkString (",") & lt; / Span & gt; & Lt; / Div & gt;
Import package view views.html.helper._ Object Bootstrap {built-in VAL Address Unit = New Field Constructor {FEFil (Element: Field Elements) = TextInput Group (Element, "@")} Built-in Val Password Input Group = New Field Constructor {Diff Apply (Element: Field Elements) = TextInput Group (element, "*") }}
@ (Signin: Form [forms.Signin]) * * Enter your real form definition * / @import assistant ._ @import views.bootstrap._ / * Inside the body * / @ Helper.form (action = routes.Auth.submit ()) {@inputText (signin ("email" ("password"), 'square - & gt; "form-control",' placeholder - & gt; "email Input password (signin ("password"), 'square - & gt;,' placeholder - & gt; "password") (passwordInput group, interact [lang]) & lt ; Button class = "BTN BTN-default" type = "submit Please sign up & raquo; & lt; / button & gt;}
No comments:
Post a Comment