1

I have a dialog box containing p:inputText with required="true" and a corresponding p:outputLabel.

<p:outputLabel for="name"   value="First Name" />
<p:inputText id="name"  value="#{userManagedBean.name}" required="true"/>

I submit the dialog box without any value causing a validation error indicated by the p:outputLabel in red required mark. But on reopening the dialog without submitting, the outputLabel is still in the invalidate state(red font). It doesnt get updated until I submit or navigate back from other page. I tried to update the whole dialog box but it wouldnt affect the label.

Thanks in advance

Dinesh Kumar
  • 2,838
  • 1
  • 16
  • 18
  • _"reopening the dialog without submitting"_, how so ? – Akheloes Jun 22 '13 at 14:50
  • Related: http://stackoverflow.com/questions/6642242/how-can-i-populate-a-text-field-using-primefaces-ajax-after-validation-errors-oc/6845800#6845800 – BalusC Jun 22 '13 at 20:46

2 Answers2

1

This is expected behaviour as input components (and related components) will maintain their state after validation fails. The state is only changed after the full request is re-executed and the complete JSF lifecycle is executed again.

You're not stating exactly how you're "updating" the panel, but I can recommend <p:resetInput/> to explicitly reset the state of related input components, without having to resubmit the entire <h:form/>. If you'd posted more meaningful code, I might have been able to give a working snippet

kolossus
  • 20,559
  • 3
  • 52
  • 104
  • Working now, but in commandLink submit I am having to give "ajax=false", can this be avoided? – Dinesh Kumar Jun 24 '13 at 06:43
  • @user1782556 - yes it can be avoided, using `` – kolossus Jun 24 '13 at 12:49
  • yes I have used for it to work, but the submit commandLink only being ajax="false", i want it to work on ajax="true" on submit – Dinesh Kumar Jun 25 '13 at 15:57
  • @user1782556 You need to post more code showing how you're using the component and the reset target. Probably something to do with your `update` attribute on the reset trigger or some other ajax issue in your setup – kolossus Jun 25 '13 at 16:19
-1

It will not be updated since opening the dialog box is happening in javascript (client side).

You need to re-render your dialog box when you open it.

Amit Tikoo
  • 167
  • 6