RSS Forums RSS
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1758 | Replies: 3
Reply
Join Date: May 2008
Posts: 1
Reputation: ban143 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ban143 ban143 is offline Offline
Newbie Poster

how to generate rows in table dynamically

  #1  
May 13th, 2008
dear frds i need
some info reg: dynamic row generation
how to generate a new row
at the end of the table at last field when i press tab or enter keys it will automatically generate a new row
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,699
Reputation: peter_budo is just really nice peter_budo is just really nice peter_budo is just really nice peter_budo is just really nice 
Rep Power: 12
Solved Threads: 318
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: how to generate rows in table dynamically

  #2  
May 14th, 2008
You need scripting language for think like this as you need to run sort of loop cycle, I would say PHP would be your best solution, JavaScript may be to complex. However all depends on your experiences
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, JAVAWUG (Java Web User Group), Coding the Architecture
Reply With Quote  
Join Date: May 2008
Posts: 2
Reputation: alexhernandez is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
alexhernandez alexhernandez is offline Offline
Newbie Poster

Re: how to generate rows in table dynamically

  #3  
May 16th, 2008
Let's say you have:
<form>
		<table id="myTable">
   <tr>
         <th>Name</th>
          <th colspan="2">Phone</th>
    </tr>
    <tr>
        <td><input type="text" name="newname" /></td>
        <td><input type="text" name="newphone" /></td>
        <td><input type="button" onclick="addContact()" value="Add"/></td>
    </tr>
</table>
</form>

You can create a function like:

<script type="text/javascript" languaje="javascript">
function addContact(){
   var myTable = document.getElementById("myTable");
   var newTR = document.createElement("tr");
   var newName = document.createElement("td");
   newName.innerHTML = document.forms[0].newname.value;
   var newPhone = document.createElement("td");
   newPhone.innerHTML = document.forms[0].newphone.value;
  
   newTR.appendChild(newName);
   newTR.appendChild(newPhone);
   myTable.appendChild(newTR);
   document.forms[0].reset()
}
</script>
Reply With Quote  
Join Date: Aug 2008
Posts: 1
Reputation: gaurish.patil is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
gaurish.patil gaurish.patil is offline Offline
Newbie Poster

Re: how to generate rows in table dynamically

  #4  
Aug 12th, 2008
hello friends.
I have two table,one(product table) for model& type of product,another maintaining (data table)quantity of a particular model,type.the attributes r like,Date,Model,Type & quantity.
I hav to create form where I can take d model & type from product table 7 put on form.
that's mean the no. of options wich contains model& text box which contains the type of that model ,both of may increase/decrease so I hav to make the dynamic them.
Also I wana add a new row by pressing tab in last textfield,
which add adds new row with option (model)&textfield.
cna any one tell me how can I do In HTMl or java script or PHP.

thanks a lot in advance....
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:13 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC