first of all start and end and sql keywords you should choose another
name.

I suggest

db.define_table('event',Field('title'),Field('start_time'),Field('end_time'))

def exclusive(form):
    if form.vars.start_time and form.vars.end_time:
        form.errors.end_time = 'you already filled start time')
    elif not form.vars.start_time and not form.vars.end_time:
        form.errors.estart_time = 'you must fill start time or end
time')

then use
form = crud.create(db.event,onvalidation=exclusive)
and/or
form = crud.update(db.event,id,onvalidation=exclusive)

On Feb 7, 6:57 am, grezly <[email protected]> wrote:
> i have a table with 3 fields:
>
> title
> start
> end
>
> For some reason i want to have the following; the title has to be
> filled in always, but for the start and end field belongs a rule to
> the fields; only 1 of the two fields can be filledin, They also can't
> be either empty or filled in.
>
> It's up to the user which one of the 2 fields he wants to fill in,
> none of them is more important than the other.

Reply via email to