-1

I am rendering html from database on a page. For each form I want to provide a button, clicking which can add a table to my database with exactly same fields in form. Is it possible to do so?

I have attached screenshot of how my page looks like now.

screenshot

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
deepak
  • 15
  • 6

1 Answers1

2

Yes, you can.

First you should have a form markup on front-end.

You should bind your data to your form inputs.

Then you should have a submit function, which collects data, then (optionally) prepares it, and then sends it (with form id) via POST request to server.

EDIT

If you need just to access the view (document) and cut the part from it. You can use, for example, document.getElementDyId or other dom access method. So you'll have html data in js var, which can be sent to server. Next moment is to parse html to fields-containing json, it can be done either before or after sending to server.

Server should handle form type and fields to create model.

If you need a solution to make class from json, take a look here

Eugene Mihaylin
  • 1,736
  • 3
  • 16
  • 31