W3C home > Mailing lists > Public > www-forms@w3.org > March 2004

Advice please

From: Robert Bateman <bobbateman@sequoiallc.com>
Date: Mon, 29 Mar 2004 17:16:42 -0500
To: www-forms@w3.org
Message-Id: <200403291716.42423.bobbateman@sequoiallc.com>

I've set up a form that uses several <select1> entries within the form to ask 
the user for information.  One area I'm having a "problem" wrapping my brain 
around is the concept of "data validation" on the client.  Let me give an 
example:

I'm working on an order entry system.  In the schema is the standard credit 
card stuff so the user can pay COD.  Because the COD is "optional", I've set 
my schema to have minOccurs="0" maxOccurs="1".  All is well here so far.

I've set up "duplicate" fields for each field involved in the COD in a temp 
<instance> along with a <boolean> PayCODNow.  My form triggers relevant for 
the COD fields on a true() in PayCODNow.  Each field displays as expected 
when PayCODNow is true.

One field I input is a credit card type.  It's a <select1> with values of 
"Choose One...", "Visa" and "Master Card".  For my purposes, I want to have 
"Choose One..." trigger the .invalid CSS so the card type stays red as my CSS 
tells it to be when invalid.  The problem I'm having is that selecting 
"Choose One..." causes a value to be set in my bound instance field (empty in 
this case.)  This is obviously invalid.

What I'd like to do is set an action on xforms-value-changed on the <select1> 
for the form type and invalidate the card type if the user hasn't choosen a 
value *other* than "Choose one..."  But I haven't yet figured out how to fire 
an event that invalidates the card type field.  I had thought I might use a 
calculate="xforms:if()" but I don't see firing an event from inside there.


Since all of you are so knowlegable, can anyone point me to how I can 
accomplish what I want to do?  I'd like to do this *without* resorting to 
script *if* possible.

Thanks much!

Bob
Received on Monday, 29 March 2004 17:21:58 GMT

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