Add new row based on input

Add new row based on input

ramhanumanramhanuman Posts: 2Questions: 0Answers: 0
edited September 2012 in General
I'm creating a registration page where someone can register up to 20 other people if they wanted to. So I have these text boxes:

[code]First Name:


Last Name:


Email:

[/code]

This is my html table with my JQuery intialization of DataTables:

[code]



First Name
Last Name
Email



[/code]

[code]
$(document).ready(function(e) {
$('#reg_more').dataTable({
"bLengthChange": false,
"bInfo": false
});
});[/code]

Now I want to put an add button so that the user can input the first and last name, and email and hit add, and it will be put into the table. How do I go about doing this? Thanks

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    Presumably you want to have it added to a database as well? So you would need to fire of an Ajax request to the server to had the data added to the database, and then use the fnAddData method for DataTables to add the new data to the display.

    The Editor plug-in for DataTables ( http://editor.datatables.net ) does a lot of this for you :-). You basically just specify the fields that you want.

    Allan
  • girishmrgirishmr Posts: 137Questions: 0Answers: 0
    Allan,
    I am having a very similar situation. I need to add rows first to the dataTable, then insert one summary record to the DB, using that transaction id, insert the rows added in the dataTable to the details table.

    So can we just add the rows to the DT?

    Thanks,
    Girish
This discussion has been closed.