OmniFaces o:validateAllOrNone in ui:repeat or h:dataTable

前端 未结 1 1809
臣服心动
臣服心动 2021-01-21 11:34

Is it possible to use OmniFaces (which is pretty cool ;)) within an or ?<

1条回答
  •  礼貌的吻别
    2021-01-21 12:08

    No, that's not possible. The components attribute must refer physically multiple components, not a single component which is rendered multiple times. It can however be used on physically multiple components which are rendered during same iteration round. The multi field validator is not designed to reference a single component which is rendered multiple times. The only OmniFaces validator which does that is .

    If you want to use the multi field validator on dynamic inputs based on a collection, then your best bet is to use JSTL . It will build physically multiple components.

    E.g.

    
        
    
    

    Assuming that there are 3 items, this will dynamically create JSF components with IDs of input_0, input_1 and input_2. Then you can just use as follows (put it outside the loop!)

    
    

    You can replace the hardcoded string in the above example by an EL expression which returns the desired space separated string of component IDs from a backing bean.

    
    

    An alternative would be to create a yourself or to post an enhancement request at OmniFaces issue tracker. It would be not exactly trivial to alter the existing that a completely separate component is desired.

    0 讨论(0)
提交回复
热议问题