Answers in text below

On May 15, 11:04 am, annet <[email protected]> wrote:
> I have a form to which I want to customize.
>
> def apply_cms():
>     response.functionname=T('Application form CMS')
>     response.image=URL(r=request,c='static',f='media/cms/banner.png')
>     form=form_factory(SQLField('bedrijfsnaam',label='Bedrijfsnaam
> *',requires=IS_NOT_EMPTY()),\
>     SQLField('kvk_nummer',label='KvK-nummer *',requires=IS_NOT_EMPTY
> ()),\
>     SQLField('subdossiernummer',default='0000',comment='(alleen voor
> nevenvestigingen)'),\
>     SQLField('u_bent',label='U bent',requires=IS_IN_SET(['de
> heer','mevrouw'])),\
>     SQLField('initialen',label='Initialen *',requires=IS_NOT_EMPTY()),
> \
>     SQLField('voornaam',label='Voornaam *',requires=IS_NOT_EMPTY()),
>     SQLField('tussenvoegsel'),\
>     SQLField('achternaam',label='Achternaam *',requires=IS_NOT_EMPTY
> ()),\
>     SQLField('telefoonnummer',label='Telefoonnummer
> *',requires=IS_NOT_EMPTY()),\
>     SQLField('email',label='E-mail *',requires=IS_NOT_EMPTY()))
>     form[0][0][0].append(H3('Bedrijfsgegevens'))
>     form[0][2][0].append(H3('Contactpersoon'))
>     form[0][7][0].append(BR())
>     form[0][-1][1].append(INPUT(_type='reset',_value='Reset'))
>     form[0][-1][1].append(INPUT
> (_type='button',_value='Cancel',_onclick='javascript:history.go(-1)'))
>     if form.accepts(request.vars,session):
>         response.flash=T('')
>         redirect
>     elif form.errors:
>         response.flash=T('form has errors')
>     return dict(form=form)
>
> Adding the second header is working:
>
> form[0][2][0].append(H3('Contactpersoon'))
>
> The first header:
>
> form[0][0][0].append(H3('Bedrijfsgegevens'))
>
> should not be appended but prepended (I want the form to start with
> this header), but prepend is not defined as a function. How do I solve
> this.

You can do

form[0][0][0].insert(i,H3('.....'))

> Furthermore, I would like to add a <br />, but this:
>
> form[0][7][0].append(BR())
>
> isn't working.

What does it mean isn't working. Look into the generated HTML, perhaps
you inserting in the wrong place (outside a table element)

> This reminded me that in tools'py's register functions it doesn't work
> either:
>
> td = form.element(_id="%s_%s__row" % (user._tablename, password))[1]
>         td.append(BR())
>         td.append(INPUT(_name="password2",
>                         _type="password",
>                   requires=IS_EXPR('value==%s' % repr(request.vars.get
> (password,None)),error_message=self.messages.mismatched_password)))
>
> besides, the password2 field doesn't display a label.

Is this your own register function? If not, what version are you
using? How are you calling it?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to