required attribute of inputText should depend on submitted value of another component

后端 未结 2 405
野的像风
野的像风 2020-12-29 00:20

I have a form which contains a dropdown and two input fields.




I would

2条回答
  •  爱一瞬间的悲伤
    2020-12-29 00:50

    Just bind the dropdown to the view and directly check its value in the required attribute.

    
        
        
    
    
    
    
    

    Note that the binding example is as-is. Do absolutely not set it to a bean property here. See also How does the 'binding' attribute work in JSF? When and how should it be used?

    Also note that the ordering of the components is significant. If the menu is located below the inputs in the tree, use #{menu.submittedValue eq 'first'} instead. Or if you want to be independent from that, use #{param[menu.clientId] eq 'first'} instead.

提交回复
热议问题