Skip to content Skip to sidebar Skip to footer

How To Create An Html Form For A Model In Playframework

In my application ,I have to present the user with an address input form.I have an Address model as given below.Do I need to create an html page from scratch to capture the user in

Solution 1:

You can reuse the CRUD tags without the CRUD controllers!

#{crud.form class:'models.ModelName' /} 
#{curd.formobject:anyInstance /} 

Please see my answer Advanced customization of CRUD forms and controllers in Play for more details.

PS.

This question was already asked but the accepted question was not satisfying for me, and I wanted to make it into a more generic question. So I asked it again but, still not getting any answer!, I finally found the solution myself :)

Solution 2:

Using CRUD module to capture user input is easier and quicker way. CRUD Module exists for such cases. Regarding whether this is the correct way, it depends. It you have lot of customization then you can overide the crud templates and it should work.

Just create a Addresses Controller extending CRUD. It would be available as part of /admin/. Thats it.

Post a Comment for "How To Create An Html Form For A Model In Playframework"