0

I've experienced different results when validation fails on my forms. I have two very similar forms using the same custom validator. On one, when validation fails, subsequent entries do not submit data. The validator has a null entry in the second parameter (Object value). I can get past it by using p:resetInput.

Before I start pulling it apart to see what is causing the different results I'd like to know what I should expect. In "normal" web forms when a user enters invalid data they simply get the opportunity to reenter valid data. They don't have to press some reset button. I would expect PrimeFaces to work like this. But if that's the case, why would we even need this resetInput button?

So the question is when is p:resetInput needed and why?

Melloware
  • 10,435
  • 2
  • 32
  • 62
user6627139
  • 406
  • 6
  • 16
  • The problem is documented right here: https://www.primefaces.org/showcase/ui/misc/resetInput.xhtml You can see the differences when resetInput is set and not set and what can happen – Melloware Feb 11 '20 at 16:09
  • Effectively it is JSF validation handling... See https://stackoverflow.com/questions/21179403/how-to-reset-input-fields-in-a-form-after-validation-fail-when-updating-it-with and from that https://stackoverflow.com/questions/6642242/how-can-i-populate-a-text-field-using-primefaces-ajax-after-validation-errors-oc/6845800#6845800 which is effectively the duplicate of this question. But also see https://stackoverflow.com/questions/12619228/reset-input-fields-without-executing-validation/12619890#12619890 – Kukeltje Feb 11 '20 at 17:28
  • The showcase example shows a separate button for submit and one for reset. That is what I want to avoid and is the crux of the question. Are separate buttons needed? – user6627139 Feb 12 '20 at 18:39
  • It seems like sometimes resetInput is needed and sometimes not. Surely (I hope) every time someone enters a wrong password or any other invalid data they don't have to hit a reset button before they can make another input. But, if not, then why would resetInput be needed at all. The showcase does not cover this and the documentation doesn't explain those differences, at least not to me. – user6627139 Feb 14 '20 at 21:26

0 Answers0