For now, this is the db model:
db.define_table('ekped',
    Field('userid'),          # From db.auth_user.id
    Field('typ_ptyx'),
    Field('idryma'),
    Field('sxolh'),
    Field('titlos'),
    Field('polh_xwra'),
    Field('etos'))

And the form->db field mapping should be like this(N is a number):
fieldaN -> typ_ptyx
fieldbN -> idryma
fieldcN -> sxolh
fielddN -> titlos
fieldeN -> polh_xwra
fieldfN -> etos

Thanks for all the help!

On Aug 4, 12:51 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> I can send an example. Can you described the model and how input
> fields should be mapped into db fields?
>
> On Aug 4, 4:50 am, cogarg <cog...@gmail.com> wrote:
>
> > Thanks for the reply, i will look into replacing the add/remove
> > functions with that jquery code, but i('ll) still have the same
> > issue;
> > I can't figure out how to make a controller that will process the
> > whole form and insert all the fields in a database.
>
> > I'm trying to write a loop to manually insert each set of fields to
> > the database if form.vars.fieldaN is not empty, but i still can't make
> > it work...
>
> > On Aug 3, 9:49 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > 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.

Reply via email to