0

I would like to use a primefaces outpulabel and an inputtext with the attributes "required" and "rendered".

This combination is working:

<p:outputLabel value="Input" for="input" />
<p:inputText id="input" required="true" value="#{myBean.input}"

If I click on a save but and nothing was entered I get the estimated error message.

But If I add the "rendered" attribute it does not work anymore;

<p:outputLabel value="Input" for="input" rendered="<some option is true>"/>
<p:inputText id="input" required="true" value="#{myBean.input}" rendered="<some option is true>"/>

Those elements are wrapped in tags. I use primefaces in version 3.5

Does anyone have an idea whats wrong here?

Thanks

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
LStrike
  • 1,598
  • 4
  • 26
  • 58
  • What does `it does not work anymore` mean? And what excatly are you using for ``? – user1983983 Jul 24 '13 at 12:33
  • I can click save without anything is entered into the input text, but no message is shown at saving is ok. In the attribute "rendered" I use an if clause to ckeck if the item should be rendered or not (both the same). Rendering is working fine. – LStrike Jul 24 '13 at 12:35
  • This construct will fail if the `rendered` attribtue evaluates `false` during apply request values phase or validations phase of the form submit request. In other words, the condition you placed in `rendered` attribute is completely wrong. As you didn't show that in SSCCE flavor in your question, it's impossible to give an answer which solves the problem. Please fix your question. – BalusC Jul 24 '13 at 14:08
  • I am not sure how to fix the question. The label and the inputtext element should only be visible, if some option is true, otherwise not. Also I want to be sure, that the user has to make some input and not leave the inputtext empty. If you like, I post the original source, but I don't think that this will help. – LStrike Jul 24 '13 at 14:20

0 Answers0