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

Advice please

From: T. V. Raman <tvraman@us.ibm.com>
Date: Mon, 29 Mar 2004 16:09:03 -0800
Message-ID: <16488.47775.552479.942679@bubbles.almaden.ibm.com>
To: bobbateman@sequoiallc.com
Cc: www-forms@w3.org

Have you perhaps considered using relevant=true/false on the
model to make this trigger automatically? i.e. the bits that ask
you for credit card details become relevant = true only when the
user picks visa or master --

>>>>> "Robert" == Robert Bateman <bobbateman@sequoiallc.com> writes:
    Robert> I've set up a form that uses several <select1>
    Robert> entries within the form to ask the user for
    Robert> information.  One area I'm having a "problem"
    Robert> wrapping my brain around is the concept of "data
    Robert> validation" on the client.  Let me give an example:
    Robert> I'm working on an order entry system.  In the schema
    Robert> is the standard credit card stuff so the user can pay
    Robert> COD.  Because the COD is "optional", I've set my
    Robert> schema to have minOccurs="0" maxOccurs="1".  All is
    Robert> well here so far.
    Robert> I've set up "duplicate" fields for each field
    Robert> involved in the COD in a temp <instance> along with a
    Robert> <boolean> PayCODNow.  My form triggers relevant for
    Robert> the COD fields on a true() in PayCODNow.  Each field
    Robert> displays as expected when PayCODNow is true.
    Robert> One field I input is a credit card type.  It's a
    Robert> <select1> with values of "Choose One...", "Visa" and
    Robert> "Master Card".  For my purposes, I want to have
    Robert> "Choose One..." trigger the .invalid CSS so the card
    Robert> type stays red as my CSS tells it to be when invalid.
    Robert> The problem I'm having is that selecting "Choose
    Robert> One..." causes a value to be set in my bound instance
    Robert> field (empty in this case.)  This is obviously
    Robert> invalid.
    Robert> What I'd like to do is set an action on
    Robert> xforms-value-changed on the <select1> for the form
    Robert> type and invalidate the card type if the user hasn't
    Robert> choosen a value *other* than "Choose one..."  But I
    Robert> haven't yet figured out how to fire an event that
    Robert> invalidates the card type field.  I had thought I
    Robert> might use a calculate="xforms:if()" but I don't see
    Robert> firing an event from inside there.
    Robert> Since all of you are so knowlegable, can anyone point
    Robert> me to how I can accomplish what I want to do?  I'd
    Robert> like to do this *without* resorting to script *if*
    Robert> possible.
    Robert> Thanks much!
    Robert> Bob

Best Regards,
T. V. Raman:  PhD (Cornell University)
IBM Research: Human Language Technologies
Architect:    Conversational And Multimodal WWW Standards
Phone:        1 (408) 927 2608   T-Line 457-2608
Fax:        1 (408) 927 3012     Cell: 1 650 799 5724
Email:        tvraman@us.ibm.com
WWW:      http://almaden.ibm.com/u/tvraman
AIM:      TVRaman
GPG:          http://www.almaden.ibm.com/cs/people/tvraman/raman-almaden.asc
Snail:        IBM Almaden Research Center,
              650 Harry Road
              San Jose 95120
Received on Monday, 29 March 2004 20:14:03 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:12 UTC