Datatables a contact form
Datatables a contact form
Hi,
I was just wondering if we can use DataTables a normal contact form? where each individual fills the form and data gets saved to database and then we can directly retrieve it from db?
I am supposed to send out form to costumers to fill out some financial information. They should be able to fill the form and on pressing submit button it gets directly saved to database where I can retrieve all the submitted data together?
Your help is highly appreciated
This question has an accepted answers - jump to answer
Answers
Datatables is a plugin to format na HTML table. Using forms and posting them to a database is a separate function. Datatables can be used to display the database but you will need to create the client / server process to display and submit the form and on the server retrieve the data and insert into the DB. Maybe this article will help.
Kevin
If you are using the Editor you could create a form then use the
create()
to create new rows in the database.Kevin
@kthorngren
Thank you. I am using the Editor and I was successfully able to create a form by using
create()
. The end user can create a new record and which gets saved in the database successfully. However, is it possible to send the form link separately without end user able to see the datatable.What I am trying to say is, the end user should access just the form with no privileges to see the datatable? and get the confirmation once the form data is submitted?
I am sorry if I am asking basic questions as I am pretty new to this.
See if this Standalone Editor example helps.
Kevin
@kthorngren Thank you.
I am sorry if I didn't explain it properly.
I am trying to make each user to insert or update just one row in datatable. So If I have 5 users , each user should have one row associated with them. Also, user should only see the row which he created or updated.
Is it possible?
I can possibly make a form and process it with java-script and PHP. Save data in database and then read that table using Datatbles plugin.
I was just wondering if there is an easy way round in editor ?
re you wanting to show the associated row in a Datatable? If so, one option is to use -
option ajax.data
to pass a search parameter that can be used to filter the returned rows to the associated row.Otherwise if you are only wanting to fetch the associated data for the form then use a jQuery Ajax request to fetch the data.
The Editor doesn't fetch the table data, thats what Datatables does.
Kevin
@kthorngren Thank you
Yes, I want to only display the data row in the table data which has been create by the user using create(). So that after the user submits the data, they can still see the data which has been submitted and edit it if needed.
As you mentioned earlier, I know I need to use something like this in the datatable and pass the search parameter but I am not sure what parameter should I pass , so the ajax only returns the newly created data rows.
@kthorngren
I just need a suggestion please.
As DataTables is mostly for data display.
Do you think it will be good idea if I made a MySQL JQuery PHP based form to populate database and then display data using Datatbles?
Thank you
Your help is highly appreciated
This plug-in can be of use here. Use it inside Editor's
submitComplete
event handler (at that point the table has redrawn, and the parameters passed into the event handler will give you the data that was added, so you can jump to that point).Allan