On Aug 2, 11:32 pm, Alastair Medford <[email protected]>
wrote:
> Alright, this quetion seems like it should have an easy answer and I'm
> just missing something. Currently IS_IN_DB is rendered as a drop down
> box. What I would like to do is have the user be able to type in an
> identification number (which as you can guess is not very easy to find
> in a dropdown or autofilled by jquery), and have it validated as being
> an ictual I.D in the database upon form submission. I'm currently
> using SQLFORM to create the form. Since as I understand it IS_IN_DB
> verifies it is in the table by fetching and listing the table entries,
> and SQLFORM first validates then submits the form, I'm a bit at a loss
> as to how to accomplish this. The only place I can think of putting a
> check is in the form accepts, but it has already been sent to the
> database by that point. Can what I'm trying to do be accomplished with
> SQLFORM or should I be doing something different? Thanks.

This should do what you want:
crud.create(db.table, onvalidation=lambda: form: myvalidator(form))

onvalidation callback runs before DB I/O
(onaccept callback is after DB I/O)

F
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to