Just don't make that check part of your onvalidation function. You can add
to form.errors at any time, so do it after the validation:
form = SQLFORM(...).process(onvalidation=onvalidation)
if form.accepted:
[check for error]
form.errors.myfield = 'Error message'
or use the onsuccess callback:
form = SQLFORM(...).process(onvalidation=onvalidation, onsuccess=
onsuccess)
Anthony
On Tuesday, January 8, 2019 at 11:19:14 AM UTC-5, Yann Dulondel wrote:
>
> Hello ,
> Is there a way to diplays error message without stopping the database
> update.
> There is an algorythm for shipping line container, but for container rent
> this doesn't apply
> [image: 2019-01-08_16h32_54.png]
> So i need to alert the user but must record the value
> Does something like that exists or an option or do i have to create an
> ajax function
> form.alert.conteneur=T('Invalid container number')
>
> def flexivalidation(form):
> container_number=form.vars.conteneur
> lconteneur=len(container_number)
> dsortie=form.vars.date_sortie
> destroy=form.vars.destroy
> if lconteneur!=0 and lconteneur!=11:
> form.errors.conteneur=T('container number must be 11 characters')
> if lconteneur==11:
> if validcntnum(container_number)==False:
> form.errors.conteneur=T('Invalid container number')
> #form.alert.conteneur=T('Invalid container number')
> form.vars.cntnumok=False
> else :
> form.vars.cntnumok=True
> if lconteneur==11 and not dsortie:
> form.errors.date_sortie=T('A fitting date is require')
> if dsortie :
> if dsortie>datetime.date.today():
> form.errors.date_sortie=T('Fitting date can not be superior
> at today')
> if lconteneur==0 and destroy==False and dsortie:
> form.errors.date_sortie=T('Put a container number or tick
> destroyed')
>
> Yann
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.