Discussion:
[Erp5-dev] Accessing the object from external validator of the workflow action form
Jacek Medrzycki
2007-03-12 16:05:54 UTC
Permalink
I'm launching the field's External Validator from the action form of a
workflow transition.

Is it possible to access - from the External Validator - the object
which is subject to the workflow transition?

Jacek
Jean-Paul Smets
2007-06-20 09:24:45 UTC
Permalink
Post by Jacek Medrzycki
I'm launching the field's External Validator from the action form of a
workflow transition.
Is it possible to access - from the External Validator - the object
which is subject to the workflow transition?
Probably, you are not using the right tool. If you need to validate data
during or before a workflow transition, you should use contraints, not
fields or field validators.

Field validators are only there to help users enter information. Field
validators should be used to validate user entries. They should not be
used to validate document data.

Regards,

JPS.
Post by Jacek Medrzycki
Jacek
_______________________________________________
Erp5-dev mailing list
Erp5-dev at erp5.org
http://erp5.org/mailman/listinfo/erp5-dev
Jacek Medrzycki
2007-06-20 09:45:22 UTC
Permalink
Post by Jean-Paul Smets
Field validators are only there to help users enter information. Field
validators should be used to validate user entries.
It is exactly what they are used for - I am validating _user_input_ on a
workflow action dialog (a customized and more complex one, with
additional workflow variables to be entered by the user). However, to
check validity of this input, I need to access the object.
I can extract the object from the request, but is there a more elegant
solution?

Regards, Jacek
Jean-Paul Smets
2007-06-20 10:01:54 UTC
Permalink
Post by Jacek Medrzycki
Post by Jean-Paul Smets
Field validators are only there to help users enter information. Field
validators should be used to validate user entries.
It is exactly what they are used for - I am validating _user_input_ on
a workflow action dialog (a customized and more complex one, with
additional workflow variables to be entered by the user). However, to
check validity of this input, I need to access the object.
I can extract the object from the request, but is there a more elegant
solution?
Sorry, I understand now. Thanks. I will try to get an answer.

JPS.
Post by Jacek Medrzycki
Regards, Jacek
_______________________________________________
Erp5-dev mailing list
Erp5-dev at erp5.org
http://erp5.org/mailman/listinfo/erp5-dev
Jérôme Perrin
2007-06-27 18:13:48 UTC
Permalink
Post by Jacek Medrzycki
I can extract the object from the request, but is there a more elegant
solution?
I only know those two solutions:

context.getPortalObject().restrictedTraverse(request.get('object_path'))
context.aq_parent.aq_parent.aq_parent

J?rome

Loading...