crud.create/crud.update can be customized in three ways:
1) using field attributes:
db.tablename.fieldname.readable = False # not in quites
db.tablename.fieldname.writable = False
db.tablename.fieldname.default = value'
2) crud.settings.formstyle='divs' or 'table2cols' or table3cols' or
'ul'
3) Using a custom form in view
{{=form.custom.begin}}
...
{{=form.custom.end}}
It may not be a good idea to manipulate the form object with
form.insert, form.append and insert INPUT fields.
On Sep 2, 2:42 pm, Albert Abril <[email protected]> wrote:
> How do you could custom a form with crud.create(db.tablename) ?
>
> Is " db.tablename.data.readable = 'False' " the correct way.. as I read in
> other posts?
>
> Regards.
>
> On Thu, Sep 2, 2010 at 3:51 PM, mdipierro <[email protected]> wrote:
> > 1) your SQLFORM does not form.accepts and fields do not have default
> > values (or use crud.create instead)
> > 2) you have a form into another form (html does not allow it)
>
> > On Sep 2, 8:45 am, Neveen Adel <[email protected]> wrote:
> > > Hello,
>
> > > I have two tables , the first one called "member" and the second one
> > > called "member_images"
>
> > > the structure as follow:
>
> > > db.define_table("member",
> > > SQLField("name", "string"),
> > > SQLField("age", "string"),
> > > )
>
> > > and
> > > db.define_table("member_images",
> > > SQLField("member_fk", db.member),
> > > SQLField("image1","upload" ),
> > > )
>
> > > and then i wanna to in the add form to display images. so i did
>
> > > form = SQLFORM(db.member,submit_button=T('Add'),showid = False)
> > > image_form =SQLFORM(db.member_images)
>
> > form[0].insert(26,TR(TD(B(T('image1'))),TD(image_form[0].element(_id='member_images_image1')),_id='image_id'))
>
> > > if form.accept(request.vars):
>
> > > db.member_images.insert(member_fk=form.vars.id,image1=form.vars.image1)
>
> > > but by the previous code , the pic saved in the member_images as a
> > > string and didn't saved into uploads folder.
>
> > > Please could anyone tell me what the problem and how to fix it ?
>
> > > Thanks in Advance
>
> > > Neveen