I realise that it's not what I need when I just press send... Since not all
the validators have passed when I want to my code to enter in action...

I face a really bizzard issue...

Here my model :

db.define_table('ref_tregistry',
    Field('tregistry_id','id'),

Field('vregistry_id',db.ref_vregistry,widget=SQLFORM.widgets.options.widget),

Field('fnaregistry_id',db.ref_fnaregistry,widget=SQLFORM.widgets.options.widget),
    Field('tome_num','integer',
        notnull=True,
        required=True,
        represent=lambda tome_num: '%02d'%(tome_num)
        ),
    Field('t_title','text'),
    Field('att_date','date',
        notnull=True,
        requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty')),
            IS_DATE(format=T('%Y-%m-%d'),error_message=T('valid date of
format : YYYY-MM-DD!'))],
        required=True
        ),
    Field('merged_for_validation', unique=True,
        compute=lambda r: str(r.vregistry_id) + \
            str(r.fnaregistry_id) + \
            str(r.tome_num) + \
            str(r.t_title).rstrip()
        ),
    migrate=False,
    sequence_name='ref_tregistry_tregistry_id_seq',
    format='%(tome_num)s %(title)s')

As you can see there is 2 FK...

Here code that is below my model :

if is_empty(str(request.vars.tome_num)) != True:
    if is_empty(str(request.vars.vregistry_id)):
        tom_entry_set =
db(db.ref_tregistry.merged_for_validation==request.vars.tome_num)
    elif is_empty(str(request.vars.fnaregistry_id)):
        tom_entry_set =
db(db.ref_tregistry.merged_for_validation==request.vars.tome_num)
        # THERE NO WAY TO GET HERE
else:
    tom_entry_set = db(db.ref_vregistry.merged_for_validation=='')


It' like if vregistry_id is never empty and when I check at it it's empty...

Richard


On Wed, Jul 6, 2011 at 12:13 PM, Miguel Lopes <mig.e.lo...@gmail.com> wrote:

> You can also use form.errors
>
> if form.accepts(...):
>    ...
> elif form.errors:
>    ...
> HTH,
> Miguel
>
>
> On Wed, Jul 6, 2011 at 5:08 PM, Anthony <abasta...@gmail.com> wrote:
>
>> form.accepts(...) returns True if all validators pass and False otherwise
>> -- is that what you're looking for?
>>
>> Anthony
>>
>> On Wednesday, July 6, 2011 11:43:29 AM UTC-4, Richard wrote:
>>
>>> Hello,
>>>
>>> Is there a way I can test if form have been submit and if no validators
>>> have triggered?
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>
>

Reply via email to