Forms do not work correcty


(Vinicius De Andrade) #1

I have developed a form in html and there is a code to catch the information that is not working.
Pessoa is “person” for portuguese.

		private FormFactory formularios;
		public Result salvaPessoa() {
			Pessoa pessoa = this.formularios.form(Pessoa.class).bindFromRequest().get();
			return ok("salva pessoa "+ pessoa.getNome());			

the code above is returning null. I also did a variation that works.

		private FormFactory formularios;
		public Result salvaPessoa2() {
			DynamicForm form = this.formularios.form().bindFromRequest();
			String nomeDaPessoa = form.get("nome");
			return ok("salvou a pessoa " + nomeDaPessoa);

But it is a clean code to make the first one works. What is wrong?

(Matthias Kurz) #2

Can you show us your Pessoa class?