right now you can do requires=IS_IN_DB(...) # options or requires=[IS_IN_DB(...)] # no options both cases validate the same serverside.
I think the same may work with XForms On Jul 1, 11:36 am, Hans Donner <[email protected]> wrote: > depending on the volume of the data the IS_IN_DB can be included (eg > data in javascript or so), so with jquery you can do some checking. > > in the end, validation must always be done on the server side > > 2009/7/1 mdipierro <[email protected]>: > > > > > this > > >> IS_NOT_IN_DB = I don't see how to support this > > > would only be serverside so nothing to do. > > > On Jul 1, 10:56 am, Fran <[email protected]> wrote: > >> On Jul 1, 4:39 pm, mdipierro <[email protected]> wrote: > > >> > If XForms hanles select/options it must be possible to send the > >> > options. no? > > >> IS_IN_SET = no problem > >> IS_IN_DB = ok, although we should continually refresh the form to see > >> new data being added > >> IS_NOT_IN_DB = I don't see how to support this > > >> The 'only show this field if previous answer was x' has no direct > >> Web2Py model analogue > >> - I use jQuery to achieve this kind of thing in HTML views > >> Am not sure if we can add something within Web2Py model to handle both > >> of these programatically or whether this will always have to be > >> something we touch up manually afterwards. > >> e.g. I have 'unit_cost' for One-time costs & > >> 'monthly_cost'/'minute_cost'/'megabyte_cost' for Recurring costs > > >> F > > >> > On Jul 1, 10:28 am, Fran <[email protected]> wrote: > > >> > > Whilst most stuff seems starightforward, the harder cases are things > >> > > like: > > >> > > db.budget_item.code.requires = IS_NOT_IN_DB(db, 'budget_item.code') > >> > > Obviously if working offline then this referencedata isn't available > >> > > - I guess we just have to ignore that within the XForm itself & handle > >> > > it during form submission. > > >> > > db.Field('created_on', 'datetime', readable=False, writable=False, > >> > > default=request.now) > >> > > The Hidden field part is straightfwd (just don't provide a Control) > >> > > But the default value doesn't make sense to be within the form > >> > > definition as it makes sense at submission time per-instance not as a > >> > > default when form is downloaded to device! (Same goes for uuid) > >> > > datetime may need some tweaking - this is available: <bind > >> > > nodeset="created-on" type="date" /> > > >> > > F --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

