Skip to content

Instantly share code, notes, and snippets.

@Felipe00
Last active October 16, 2015 23:10
Show Gist options
  • Save Felipe00/5a506a92a9f842aa28dc to your computer and use it in GitHub Desktop.
Save Felipe00/5a506a92a9f842aa28dc to your computer and use it in GitHub Desktop.
Manda o id sempre null para o controller
public Result update(Long id) {
Form<Local> editForm = localForm.bindFromRequest();
Local localFromForm = Local.find.byId(id);
if (editForm.hasErrors() || editForm.get().getId() == null) {
return badRequest(views.html.localEdit.render(localForm, localFromForm.getMainUser(), id));
}
Local local = editForm.get();
Ebean.refresh(local);
return redirect(routes.LocalController.localByUser(localFromForm.getMainUser().getId()));
}
@form(routes.LocalController.update(id), 'class -> "container center") {
<div class="row">
<div class="input-field col s6 center">
<input type="text" id="name" name="name"
value="@localForm.apply("name").value" />
<label for="name">NOME DO LOCAL</label>
</div>
<div class="input-field col s6">
<input type="text" id="cnpj" name="cnpj"
value="@localForm.apply("cnpj").value" />
<label for="cnpj">CNPJ</label>
</div>
</div>
<div class="row">
<div class="input-field col s6">
<button class="btn waves-effect waves-light right" type="submit"
name="action">
Concluir
</button>
</div>
</div>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment