I am using the play framework 2.3.8 with twitter Bootstrap 3.3.4 and have several forms in my application, where you can enter input.
Sample:
@import models.Question
@import models.Answer
@import helper._
@import helper.twitterBootstrap._
@(questionForm: Form[Question], questionList: List[Question])
@main("Ask Question"){
@helper.form(action = routes.Application.sendQuestion()){
<fieldset>
@helper.inputText(questionForm("questionID"))
@helper.inputText(questionForm("questionText"))
@helper.inputText(questionForm("voteScore"))
@helper.inputText(questionForm("userID"))
@helper.inputText(questionForm("page"))
</fieldset>
<input type="submit" class="btn btn-default">
}
}
Now, if I compile, there are several warnings in the terminal:
[warn] @helper.inputText(questionForm("userID"))
[warn] ^
[warn] (...)frageAntwort.scala.html:22:
value twitterBootstrapField in package twitterBootstrap is deprecated:
The twitter bootstrap field constructor will be removed from Play in 2.4
since the way Bootstrap must be used changes too frequently and too
drastically between versions for this to make sense to be in the core of Play
I’ve searched for the warning and only found this old SO post about it and an issue on github.
The SO post mentions to write his own template helper, but as my own is working I see no need yet to write one. So can I still use mine and ignore the warnings, or will I get into trouble later in my productive system or anywhere else? Also if the warnings have no consequences, is there a way to hide them?
2
Answers
In the Play 2.3 migration guide there’s a section intended to explain that issue. It says that:
Even if it works now there can be a problem in the future. If I were you, I’d plunk for writing a custom solution. Only that way you can be sure that after framework upgrade in your project everything will still work fine.
Now, there is Play-Bootstrap with support of Bootstrap 3 and Bootstrap 4 and Play 2.4 and Play 2.5.
The
SNAPSHOT
builds cannot be directly loaded, you have to do(Source: https://github.com/adrianhurt/play-bootstrap/blob/master/play25-bootstrap3/sample/build.sbt)