I suggest you use this: http://muiomuio.com/web-design/add-remove-items-with-jquery
and here is a demo: http://muiomuio.com/tutorials/jquery/add-remove/ Massimo On Aug 3, 1:19 pm, cogarg <cog...@gmail.com> wrote: > Hello, > > I just starting using web2py and i am a little bit lost, since my > knowledge of > html/css/js/python are mediocre at best. > > What i wanted to create is a form with some standard fields and an > option > to add more fields(single button, adds 6 fields - an entire db > record). > > So far, so good, the html/js portion looks solid, but i can't figure > out how to > add the extra fields to the database. > > I've used the following js code, which i refined from various > examples, which > also inserts a number after each and every field name, so the fields i > have to > work with are named fieldaN , ... , fieldfN . > > <script language="JavaScript"> > var items=0; > function insRow() > { > items++; > var x=document.getElementById('myTable').insertRow(-1); > var a=x.insertCell(0); > var b=x.insertCell(1); > var c=x.insertCell(2); > var d=x.insertCell(3); > var e=x.insertCell(4); > var f=x.insertCell(5); > a.innerHTML="<input name=\"fielda" + items + "\" />"; > b.innerHTML="<input name=\"fieldb" + items + "\" />"; > c.innerHTML="<input name=\"fieldc" + items + "\" />"; > d.innerHTML="<input name=\"fieldd" + items + "\" />"; > e.innerHTML="<input name=\"fielde" + items + "\" />"; > f.innerHTML="<input name=\"fieldf" + items + "\" />";} > > function delRow() { > document.getElementById('myTable').deleteRow(-1)} > > </script> > > I know this is a very bad way to implement this, and i would > appreciate any help.