1

Suppose that i have a scala template that take single userName and age as input and submit that we can simply handle binding and passing form of class

Class FormExample {
   String userName;
   int age;
}

Now suppose user want one more button like add_more_user and when he clicked on add_more_user he will get new row where he can insert other userName and Age in same. And once he click on submit all username and age must be saved in databases.

My question is how to handle this dynamic functionality in scala template and inside controller so that once user click add_more_user button one new row appear and there he can add new userName and age and controller can received list of value once he click on submit button. I tried using list but not able to received value.

I am useing play2.4 and my controller code in java 1.8

visingh
  • 233
  • 3
  • 17
  • Use some client-side JavaScript for the dynamic placement of the new row (AngularJS, jQuery, etc.) Consider giving proper `name`s to the input fields - this way they are going to be present in the submit / POST request and you can manipulate them on the Controller side – Anton Sarov Mar 26 '16 at 17:53

0 Answers0