Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Adding more form fields reloading the page


Message #1 by "Fabiano Schimidt" <f_schimidt@b...> on Fri, 22 Mar 2002 11:47:40
Hi, 

 The following Example Should help you. In this I am adding some fields 
dynamically when the user clicks on Button. 
 
 This way you can add any field to the form dynamically. 

 I hope this is what you need, if I got your problem correct.

======================================================================
<SCRIPT LANGUAGE=javascript defer='true'>
<!--
function add() {
     var tbl  = window.document.getElementById("d1") ;
      var row;
   for(i=2 ; i<=10; i++) {
    row = tbl.insertRow();
    row.insertCell(0).innerHTML = "<input type='text' name='t"+ i +"'>";
  }
}
		
		
//-->
</SCRIPT>

</HEAD>
<body >
<form name='f1'>
<input type='button' value='Add 10 Rows' onClick='add()'>
<table id='d1'>
	<tr><td><input type=text name='t1'></td></tr>
	
</table>
<P>&nbsp;</P>

</form>
=======================================================================

Thanks & Regards
Veera R Ponna

> Hi everybody,

> I need to create a function that adds a set of fields in a existing 
form. 
F> or example, the Easy Upload tool of Geocities File Manager. Initially 
t> here are 5 upload fields, you can increase the number of fields and 
click 
o> n Display, so more upload fields are added to the form.

> In my case there is form like a excel sheet, 10 lines composed by text 
and 
s> elect fields. I have a button that must add more 10 lines.

> Thanks in advance!

> Regards,
F> abiano

  Return to Index