Last active
October 16, 2015 23:10
-
-
Save Felipe00/5a506a92a9f842aa28dc to your computer and use it in GitHub Desktop.
Manda o id sempre null para o controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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())); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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