I've just started with Play Framework and I'm looking to create input field in scala template but without label and for some reason I'm unable to get rid of the generated label element. Here is how my code looks like :
@helper.inputText(form("name"), 'id -> "name", 'class -> "ui-state-default", 'autocomplete -> "off", 'placeholder -> "Please write name ...")
So I end up with this element along with my input (looking at browser source code) :
<dt><label for="s2id_autogen2">name</label></dt>
Is there any way of removing it?
Play is rock-solid and used by hundreds of thousands of Java and Scala developers every month. Play is still extremely relevant to today's application and web development and has a passionate and very capable community around it ensuring that it has many good years left.
The activator command can be used to create a new Play application. Activator allows you to select a template that your new application should be based off. For vanilla Play projects, the names of these templates are play-scala for Scala based Play applications, and play-java for Java based Play applications.
Play comes with two configurable server backends, which handle the low level work of processing HTTP requests and responses to and from TCP/IP packets. Starting in 2.6. x, the default server backend is the Akka HTTP server backend, based on the Akka-HTTP server.
Play's form handling approach is based around the concept of binding data. When data comes in from a POST request, Play will look for formatted values and bind them to a Form object. From there, Play can use the bound form to value a case class with data, call custom validations, and so on.
My solution was :
@helper.inputText(form("name"),
'id -> "name",
'class -> "ui-state-default",
'autocomplete -> "off",
'placeholder -> "Please write name ...",
'_label -> null
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With