I am using this to learn play-framework with slick
.
I have this url
form in my controller
val urlForm = Form(
mapping(
"id" -> ignored(Some(0): Option[Long]),
"link" -> nonEmptyText,
"shortLink" -> nonEmptyText)(Url.apply)(Url.unapply))
On the view
side, it is rendered as
@form(routes.Application.save()) {
<fieldset>@formElements(urlForm)</fieldset>
<div class="actions">
<input type="submit" value="Create this url" class="btn btn-primary"> or
<a href="@routes.Application.list()" class="btn btn-default">Cancel</a>
</div>
}
I have two questions:
1- How can I fill shortLink
from data filled in link
field and make it hidden for user.
2- How can I validate if data filled in link
field is a valid URL
Things I have tried:
1- Reading this and trying to use it in my project, but couldn't apply it.
2- Seeing answers on how to make fields hidden, but didn't work on this project because the view is just creating all the fields from formElements(urlForm)
making me unable to set them hidden manually.