The controller is...
def reg_info():
form = SQLFORM(db.attendees)
form.append(
Field('verify_email','string',
requires = IS_EXPR('value==%s' % repr(request.vars.get
(form.vars.email, None)),
error_message=T('Emails do not
math'))))
if form.accepts(request.vars):
response.flash = 'form accepted'
session.attendee_name = "%s %s" %
(form.vars.first_name,form.vars.last_name)
redirect(URL(r=request,f='thank_you'))
elif form.errors:
response.flash = 'form has errors: %s' % form.errors
else:
response.flash = 'Please fill out the registration
form'
return dict(form=form)
When I try to use in the view
<div class="left"> {{=form.custom.label.verify_email}}
{{=form.custom.widget.verify_email}}</div>
I get '<no table>.verify_email'
I guess what I'm looking for is the ability to add a Field to a
SQLForm that doesn't get stored in the DB. For now I'm just add it to
the db.py with a custom validator but seems like there must be some
way to make this a contoller/view addition without touching the
model. Thanks for your time mdipierro!
On Jan 6, 6:19 pm, mdipierro <[email protected]> wrote:
> Can you post an example of your code?
>
> On Jan 6, 7:22 pm,Delaney<[email protected]> wrote:
>
> > On page 228 of the web2py manual I see the docs pertaining to almost
> > exactly what I'm trying to do with the title 'Validators with
> > Dependencies' and see that 'The same mechanism can be applied to FORM
> > and SQLFORM objects.'
>
> > However I don't want 'password_again' in the database. If I try
> > inserting/append the Field into the sqlform it complains about not
> > being in the table. Am I missing something?
>
> > On Jan 6, 2:37 pm,Delaney<[email protected]> wrote:
>
> > > Thanks for that, but it doesn't seem to work when using
> > > sqlform.custom.label & wigdets. Which is how I happen to be doing the
> > > whole form for this application. Is there an alternative?
>
> > > On Jan 1, 9:21 am, mdipierro <[email protected]> wrote:
>
> > > > form=SQLFORM(...)
> > > > form[0].insert(position, TR(
> > > > LABEL(self.messages.verify_email + ':'),
> > > > INPUT(_name="email_two",
> > > > _type="email",
> > > > requires=IS_EXPR('value==%s' % \
> > > > repr(request.vars.get(email, None)),
> > > > error_message=T('Emails do not math')),'')
>
> > > > On Dec 31 2009, 5:52 pm,Delaney<[email protected]> wrote:
>
> > > > > So I'm finishing up my first web2py program (has been interesting,
> > > > > once you 'get' the web2py way of doing things. One last thing left.
> > > > > I need tolinkthe actions of a fewinputsfrom a SQLForm together.
>
> > > > > Specifically I need a double emailinputsthat have to matched but
> > > > > don't really need the second one in the model, or do I?
>
> > > > > Also need tolinka drop downinputand stringinput, so if the drop
> > > > > down option is 'Other' the stringinputhas to be filled out,
> > > > > otherwise it need to be empty.
>
> > > > > Where in the manual or online docs can I find the best way to
> > > > > implement this?
>
> > > > > Thanks!
--
You received this message because you are subscribed to the Google Groups
"web2py-users" 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.