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

Re: Fw: Disabling a button based on validity

From: <andyh@collegenet.com>
Date: Thu, 27 Oct 2005 16:16:57 -0700
To: Erik Bruchez <erik@bruchez.org>
Cc: www-forms@w3.org, www-forms-request@w3.org
Message-ID: <OFDAD5B103.D743B900-ON882570A7.007E659A-882570A7.007FD982@collegenet.com>





Well yeah probably with sizable forms, my forms are fairly small at the
moment :-)

However the technique I outlined is straightforward and should work on all
processors.
Agreed it can be improved, and now that I've had a bit of time to tinker I
have an improvement for all the fPer's out there.


The latest version of fP (1.3.8) introduced an extension function to return
the validity of a node. So I can now reduce the error counting to a single
calculate and no per control actions.

<xf:instance id="iErrors">
      <errors xmlns="">
            <count>0</count>
            <save/>
            <nosave/>
      </errors>
</xf:instance>

<xf:bind nodeset="instance('iErrors')/count"
calculate="count(instance('iUser')//*[fpext:valid(.) = 0])"/>
<xf:bind id="bndSave" nodeset="instance('iErrors')/save" relevant="../count
= 0" />
<xf:bind id="bndNoSave" nodeset="instance('iErrors')/nosave"
relevant="../count &gt; 0" />



Andy




                                                                           
             Erik Bruchez                                                  
             <erik@bruchez.org                                             
             >                                                          To 
             Sent by:                  www-forms@w3.org                    
             www-forms-request                                          cc 
             @w3.org                   www-forms@w3.org                    
                                                                   Subject 
                                       Re: Fw: Disabling a button based on 
             10/27/2005 02:08          validity                            
             PM                                                            
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           





andyh@collegenet.com wrote:

> The code I presented below is not that cumbersome. Once you have the
> instance and the three binds, you need a single instance data element per
> field and two simple event handlers per control.

You are kidding, right? It is EXTREMELY cumbersome. Again, this is
functionality that you want in pretty much every XForms page. It should
be achievable with an attribute or two.

-Erik
Received on Thursday, 27 October 2005 23:17:06 GMT

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