faces icon indicating copy to clipboard operation
faces copied to clipboard

Allow refreshable ValueExpression for validator/converter/behavior tags

Open tandraschko opened this issue 4 years ago • 4 comments

Attributes on validators and converters are created and evaluated built time. We may just need to introduce stateHelper like in components.

There are many workarounds in the past to support ValueExpression correctly for that cases:

  1. PrimeFaces behaviors: https://github.com/primefaces/primefaces/tree/master/src/main/java/org/primefaces/behavior/base
  2. MyFaces common converters https://cwiki.apache.org/confluence/display/MYFACES/MyFaces+Commons+Converters
  3. MyFaces commons validator https://svn.apache.org/repos/asf/myfaces/commons/trunk/myfaces-commons-validators/src/main/java/org/apache/myfaces/commons/validator/

also see: https://issues.apache.org/jira/browse/MYFACES-3547 https://stackoverflow.com/questions/4439850/refresh-jsf-validator-attributes-on-rerender

Actually it's not a big feature, it just makes it easier to use and align the APIs with component attributes.

tandraschko avatar Apr 19 '20 12:04 tandraschko

OmniFaces <o:validator> and <o:converter> tags also basically convert all attributes of existing validators/converters to deferred value expressions.

  • https://showcase.omnifaces.org/taghandlers/validator
  • https://showcase.omnifaces.org/taghandlers/converter

BalusC avatar Apr 14 '21 08:04 BalusC

@BalusC i would like to work on this. How should we proceed? introduce a StateHelper, same like on Components? Wouldnt be that much work and we have the same API. I would start with behaviors first.

tandraschko avatar May 12 '21 11:05 tandraschko

There is also another problem when e.g. dealing with a validator inside UIRepeat in our MF ValidatorTagHandlerDelegate we check the disabled flag on build-time but the disabled EL might reference to a ui:repeat var so if you load the page the first time and no ui:repeat item is present, do an AJAX update on the repeat with items, the validation will just be skipped

there may be other places in the spec which needs to be checked

tandraschko avatar Jan 13 '23 13:01 tandraschko

thats a bit more work, we need to introduce StateHelper for converters and so on; lets move to 5.0

tandraschko avatar Feb 25 '23 16:02 tandraschko