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

Re: Disabling a button based on validity

From: Erik Bruchez <erik@bruchez.org>
Date: Tue, 25 Oct 2005 18:32:24 +0200
Message-ID: <435E5E18.6060708@bruchez.org>
To: www-forms@w3.org

Thanks, Peter. However, this is not quite what I want, and I apologize 
if my question was not clear.

What I want to do is leverage work already done to validate the XForms 
instance. I do not want to rewrite in XPath all the rules already 
created with XML Schema types, constraint attributes, and required 
attributes: this would be painful and error-prone code duplication. I 
really want the valid and required properties to be leveraged.

-Erik

Kisuule, Peter wrote:
> 1.  Place your button in a group like this..
> 
> 	<xf:group bind="enableButton">
> 		<xf:trigger ......>
> 		.........	
> 		</xf:trigger>
>      </xf:group>
> 
> 2.  In the model create a bind like this....
> 
> 	<xf:instance id="temp">
> 		<tempData>
> 			<SubmitButton/>
> 		</tempData>
> 	</xf:instance>
> 	
> 	<xf bind id="enableButton" nodeset="instance('temp')/SubmitButton"  
> 					relevant="calculate (field1... has data  and field2 has data ....) />
> 
> When relevant is "true"  the button will show up and it will vanish when relevant is false.  This is what Model Based Switching is all about
> 
> 
> Peter
> 		
> 
> -----Original Message-----
> From: www-forms-request@w3.org [mailto:www-forms-request@w3.org]On
> Behalf Of Erik Bruchez
> Sent: Tuesday, October 25, 2005 11:32 AM
> To: www-forms@w3.org
> Subject: Disabling a button based on validity
> 
> 
> 
> All,
> 
> I am having trouble figuring out the solution to an extremely basic UI
> requirement: disabling a submit button, implemented either with
> xforms:submit or xforms:trigger, until certain fields have been filled
> out correctly by the user.
> 
> Of course, you could leave the button always enabled. Upon XForms
> submission, if the submitted instance is not valid or has missing
> required fields, submission will fail, throw an xforms-submit-error,
> and you can notify the user of the failure. But from a usability
> perspective, this is usually a bad solution.
> 
> So these are my questions:
> 
> 1. How do people address this UI requirement today with XForms? Is
>     there a way of doing this purely based on the XForms 1.0
>     specification? If not, are there workarounds? For example, we have
>     played with counting xforms-valid and xforms-invalid events,
>     clearly a quite heavy solution.
> 
> 2. If the answer to #1 above is "no" or "here is a way, but it's
>     really a dirty hack":
> 
>     2.1. Is the WG working on addressing this? (I should talk with
>          Sebastian but it doesn't hurt to ask this publicly.)
> 
>     2.2. Are there extensions suggested or implemented by existing
>          XForms engines that address this?
> 
> Thanks,
> 
> -Erik
> 
> 
> 
> ------------------------------------------------------------------------------
> Confidentiality Note:  This message is intended for use only by the individual or entity to which it is addressed and may contain information that is privileged, confidential, and exempt from disclosure under applicable law.  If the reader of this message is not the intended recipient or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error,  please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy.  Thank you.
> ------------
> Visit us online at our award-winning http://www.clevelandclinic.org for a complete listing of Cleveland Clinic services, staff and locations from one of the country's leading hospitals.
> ==============================================================================
> 
Received on Tuesday, 25 October 2005 16:32:26 GMT

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