W3C home > Mailing lists > Public > www-forms@w3.org > September 2005

RE: switch and validation

From: Mark Birbeck <mark.birbeck@x-port.net>
Date: Tue, 13 Sep 2005 17:33:21 +0100
Message-ID: <D13E9633-E8FC-40B2-BD73-B47CD85935C8@S009>
To: "'Joern Turner'" <joern.turner@web.de>
Cc: <www-forms@w3.org>

Joern,

> the problem:
> 
> if i have a switch statement with several cases and each case 
> itself constituted a view/page for the user (meaning the 
> content of a case uses the whole viewport of the client) 
> there might occur a validation problem or more precisely a 
> problem with signaling validation errors through alerts.
> 
> e.g. the user fills out 'page 1' and moves on to another 
> case. Fills out other data which by some calculation or 
> action lead to validation failures on 'page 1'. - The user 
> won't receive any alert messages and will be left without a 
> clue what may have gone wrong.
> 
> Is there a solution which i oversee?

There is no general solution. The obvious one is to reposition all alerts,
but the probably wouldn't show when on controls that are in hidden cases.

But a technique we began to use recently is to use groups that are bound to
the node you are interested in, but place them in a completely different
part of the form:

  <xf:switch>
    <xf:case id="page1">
      <xf:input ref="age">
        ...
      </xf:input>
    </xf:case>
    <xf:case id="page2">
      <xf:group ref="age" class="error-message">
        Age has been entered wrongly. Click here to go edit it...
      </xf:group>
      .
      .
      .
    </xf:case>
  </xf:case>

All you need to do for this to work is use CSS to *hide* valid xf:groups
with a class of "error-message". The nice thing about this technique is that
the contents of the group can be anything, so you can put in other controls
that might help the user, or perhaps a trigger that toggles the sub-form in
question.

Another version of this technique is to group all of your error messages
into a scrollable footer so that they are always 'visible' wherever you are
in the form.

Regards,

Mark


Mark Birbeck
CEO
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
w: http://www.formsPlayer.com/
b: http://internet-apps.blogspot.com/

Download our XForms processor from
http://www.formsPlayer.com/
Received on Tuesday, 13 September 2005 16:34:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:01 GMT