Possible to execute `valueChangeListener` for `p:inputText` without hitting `enter` key?

前端 未结 1 676
无人及你
无人及你 2020-12-19 10:52

I\'d like to execute valueChangeListener for p:inputText when user changes text and inputText looses focus (onchange). Is this possible? For now it

1条回答
  •  春和景丽
    2020-12-19 11:39

    The valueChangeListener method requires a form submit to be invoked. This is a server side event, not a client side event or so. Just changing and blurring the input does by default not submit the form at all. Bring in a to do the magic.

    
        
    
    

    However, although you didn't tell anything about the concrete functional requirement for which you thought that this is the right solution, I just wanted to mention that the valueChangeListener is more than often the wrong tool for the job you had in mind. Use instead.

    
        
    
    

    Note that this would then make it possible to pass method arguments by EL 2.2, which would immediately then answer the possible underlying functional requirement of your other — actually pretty poor — question.

    
        
    
    

    Also note that this might not be the solution at all if you're actually interested on the entered value; you could just access the inputValue property directly.

    See also:

    • When to use valueChangeListener or f:ajax listener?

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