Re: Disabling a button based on validity

Vincent Berger wrote:
> Hi Erik,
> 
> Le mardi 25 octobre 2005 à 18:49 +0200, Erik Bruchez a écrit :
> 
>>Thanks Andy. It makes sense, and unfortunately (for you and I) falls 
>>into the category "here is a way, but it's really a dirty hack" ;-)
>>
>>We have done exactly the same things by placing a single event handler 
>>higher up the XHTML, to catch all the validation events of a group of 
>>controls, and incrementing vs. decrementing a counter. This takes about 
>>10-15 lines of extra code, including the extra instance. I think that 
>>ideally such a functionality should be achieved with a single attribute.
>>
> 
> This extra-code is not so easy to do for me. And furthermore difficult 
> since David Landwehr
> show me that an event 'xforms-invalid' is dispatched when an invalid 
> data is changed to a still invalid value.

Is that what the spec says? It turns out that yes, in the proposed 
second edition: "Dispatched in response to: an instance data node either 
changing and *being* or becoming invalid.", plus all of "4.3.4 The 
xforms-refresh Event".

It would be interesting to know the rationale behind resending MIP 
events whenever the value changes, even if the properties associated 
with the value have not changed. Somebody who knows, please?

OPS right now only sends those events when the properties change.

> In the first extra-code I´ve done, the counter was incremented in the 
> case above ... and it´s wrong of course.
> My second extra-code works but is too dirty to be written there.
> 
> Shall I see yours, please ?

In an XForms engine sending multiple xforms-valid and xforms-invalid 
events when the node validity doesn't change, my code won't work. 
Anyway, all this event counting strategy is an unacceptable hack!

I am thinking that two new CSS (pseudo-) classes would do the trick, 
with the meaning that the control would be bound to a node which would 
be submittable or not according to the rules of xforms:submission.

-Erik

Received on Thursday, 27 October 2005 18:48:25 UTC