Re: Fw: Disabling a button based on validity

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 UTC