@(myForm: Form[FormObject])
@import helper._
@import helper.twitterBootstrap._
@main("Test") {
@form(routes.Application.save) {
@input(myForm("number"), '_label -> "Number") { (id, name, value, args) =>
@if(value.isEmpty) {
<input type="text" name="@name" id="@id" value="@value">
} else {
<input type="text" name="@name" id="@id" value="@value" disabled>
}
}
@input(myForm("startDate"), '_label -> "Start Date") { (id, name, value, args) =>
<div class="input-append date datepicker" data-date="@value" data-date-format="dd-mm-yyyy">
<input class="span2" size="16" type="text" value="@value"><span class="add-on"><i class="icon-calendar"></i></span>
</div>
}
<button type="submit" class="btn" title="Save"><i class="icon-ok"></i></button>
}
}
public class FormObject {
public String number;
public String startDate;
}
The first issue is that when the value of field 'number' is not empty (and therefore shown disabled) is not bind back to FormObject, so I lose this value.
The second issue is that field 'startDate' is not bind to FormObject.
Am I missing something?