0

I have the following code and scenario: An output text that will be updated upon user clicking one button.I want to validate in UI when the value updated is empty.

<h:outputText  id="Input" value="#{myBean.inputValue}"/>
<p:commandButton update="Input hide"/> //Ajax is true in this button
<h:inputHidden id="hide" value="#{Input}" required="true" requiredMessage="Value cannot be empty" />

I need to update both output text and Hidden value at the same time since I cannot perform validation operations on output text. but what happens is only the output text gets updated and inputHidden is always throwing required message, it is not getting updated. Can anyone please suggest why this is failing?

  • Possible duplicate of [Understanding PrimeFaces process/update and JSF f:ajax execute/render attributes](https://stackoverflow.com/questions/25339056/understanding-primefaces-process-update-and-jsf-fajax-execute-render-attributes) – Jasper de Vries Feb 05 '19 at 14:25
  • 1
    Your example seems to be very weird / invalid. I'm not sure if it makes sense to make a hidden input required. Also what should value="#{Input}" do? – tandraschko Feb 05 '19 at 14:32
  • 1
    As with https://stackoverflow.com/questions/54457797/updating-an-ui-value-from-javascript-is-not-getting-reflected-in-javabean this still / also looks like a XY problem. – Jasper de Vries Feb 05 '19 at 15:57
  • Thanks alot for the link @JasperdeVries It solved my issue :) – user3729090 Feb 11 '19 at 12:21

0 Answers0