Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Extracting Values from a dynamically created row.

    I have created a table and using the table id, I have created rows dynamically using the id of the table. I have also inserted cells and added values to that. Now I have to extract the values individually and add it to a textbox and edit it and I have to save it in the same cell from where I have brought the value.

    I need to do these using Javascript. It's working fine if there is only one row. But I need to create multiple rows and the last 2 cells of each row contains an "Edit" and a "Delete" button. If I click the particular "Edit" or "Delete" button that values should be brought to the text boxes and edited and saved back.

    Thanks in Advance.............
    Can anyone please reply. It would be so helpful.
    Last edited by sudhasundaram; 06-19-2007 at 02:10 PM.

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Helped if you showed us code!

    Give each row an id and reference that id with the button click.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    codings--

    <html>
    <body>
    <script>
    var variable1,variable2;
    function show(id)
    {
    var itm=document.getElementById(id);
    if(itm.style.display == 'none')
    itm.style.display ='';
    }


    function addrow(fname,emailid)
    {
    if(fname.value !="" && emailid.value != "")
    variable1=fname.value;
    variable2=emailid.value;
    t1.innerHTML="\""+variable1+"\""+"&lt"+variable2+"&gt"+"&nbsp;&nbsp;&nbsp;&nbsp;"+"<input type=button name=edit value=Edit onclick='validateedit()'>"+"&nbsp;&nbsp;&nbsp;&nbsp;"+"<input type=button name=delete value=delete onclick='validatedelete()'>";
    fname.value="";
    emailid.value="";
    frm.add.value="add";
    }
    function validateedit()
    {
    frm.fullname.value=variable1;
    frm.email.value=variable2;
    frm.add.value="Edit";
    t1.innerHTML="";
    }
    function validatedelete()
    {
    t1.innerHTML="";
    }
    </script>
    <form name="frm">
    <div id="t1" style="display:none">
    </div>
    Fullname<input type="text" name="fullname"><br>
    EmailAddress<input type="text" name="email"><br>
    <input type="button" value="add" name="add" onclick="show('t1'),addrow(this.form.fullname,this.form.email)">
    </form>
    </body>
    </html>



    This works fine for 1 row. But each row created that particular values should be edited and updated.
    ssdram


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •