www.webdeveloper.com
Results 1 to 2 of 2

Thread: Populating

  1. #1
    Join Date
    Jan 2009
    Posts
    1

    Populating

    Hey guys sorry to bother... I just started learning JavaScript. Anyway, I'm working on this form... that every time a user enter a new record it will update the table underneath it, but I would like to add a button on the end of every row of this table for the user to edit that particular entry, on the FORM above and change the value of a hidden field that determines the action that the PHP script will take either INSERT or UPDATE both elements dynamic table and form are on the same page, and every table row has several different values, 6 to be more precise.

    Could someone please help me on that? I searched on Google "update form fields with JavaScript, populate form fields with JavaScript" but I might even not be searching for the right thing... the results I got were about updating a form after submission :S and others...

    Thanks in advance guys and Happy New year for everyone!

  2. #2
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,773
    I would suggest keeping the table and the hidden form fields in separate places. When you have a JavaScript Document Object Model (DOM) node reference to a <form> tag, the browser creates a whole slew of references to the fields inside the form for you. The problem is, when you dynamically add form fields to the DOM, special care must be taken.

    Reading the two blog posts I linked to above is a good place for you to start. Also, get acquainted with the table DOM too:

    <table>, <thead>, <tfoot>, <tbody>
    <tr>
    <td>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles