4 Replies Latest reply on Mar 7, 2011 2:54 PM by David Maple

    rich:validator passedLabel

    David Maple Newbie

      I'm really excited about the client side validation that seems to be working now that I've updated to M6. One thing I'd really like to be able to do is display a passedIcon to the user when they pass client side validation. Is there any plan to fully implement this functionality into Richfaces? If not is there a way to hook some additional client logic to be executed oncomplete of the client side dom update to diplay the rich:message?

        • 1. rich:validator passedLabel
          Alexander Smirnov Master

          We put off 'passed' state in messages, because it's not clear how to implement that. In the mose cases, fields that user didn't touch should not show errors nor 'passed' status. Some attempts to implement that scenario in RF 3.3 doesn't work well, so we decided to review use cases and algorithms after 4.0 release.

          • 2. rich:validator passedLabel
            David Maple Newbie

            np. I have a workaround for now. It's a bit hackadoo but it totally works. I just style rf-msg something like:

             

            .ok {

                      background: url('/img/ok.gif') top left no-repeat;

            }

             

             

            .rf-msg {

                      position: absolute;

                      top: 3px;

                      left: -5px;

                      width: 12px;

                      height: 12px;

                      display: block;

            }

             

             

            .rf-msg-err {

                      background: url('/img/error.gif') top left no-repeat;

                      position: absolute;

                      top: 0;

                      left: 0;

                      width: 12px;

                      height: 12px;

                      display: block;

            }

             

             

            .rf-msg-dtl { display: none; }

             

             

            and then add a jquery on blur to the inputText (or whatever):

             

            onblur="if ($('#nameLast').val().length > 0) { $('#nameLastMessage').addClass('ok'); return true;} else { $('#nameLastMessage').removeClass('ok'); return true; }"

            • 3. rich:validator passedLabel
              Alexander Smirnov Master

              We already tried similar ways... the problem is that if field is required and you remove all input message will show 'Ok' again - and it's incorrect state. Having form submit and server-side messages adds mess to it.

              Common use case should use more sofisticated algorithm to detect correct value and to not mark input as 'valid' then you remove input.

              • 4. Re: rich:validator passedLabel
                David Maple Newbie

                Alexander, your extremely excellent points are really raining on my parade!

                 

                I suppose it I knew that the whole validation was to be executed on the client I could use keyup as the event which would avoid this pitfall  .... but I do see that this may be a slippery slope.