Advice please

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 UTC