You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jeremy Quinn <je...@media.demon.co.uk> on 2004/01/15 21:17:13 UTC

Woody and WAI

Hi All,

I am in the process of getting some Woody forms approved as WAI 
compliant.

	http://www.w3.org/WAI/

While WAI may not be everybody's cup of tea ..... in certain sectors it 
is a common requirement .... and it is certainly not a bad selling 
point.


There are three issues which come up regularly with basic Woody forms:

1) Provide an explicit label for each form control. (Level 2)
2) Include default, place-holding characters in edit boxes and text 
areas. (Level 3)
3) Provide a summary for tables. (Level 3)

I am thinking that these are issues which Woody could handle 
automatically for us.
While there are obviously workarounds for all of these, I think it 
would be advantageous to make this work as automatically as possible, 
where it does not interfere with anything.

Issue (1) requires that a form field have a label linked to it:

	<label for="name-field">Your Name</label>
	<input id="name-field" name="name" title="your name here" type="text" 
etc. />

While this issue can be solved by wrapping the <label> tags around your 
<wt:widget-label>s in your template, if WoodyTransformer were changed 
to preserve the <wt:widget-label> tag instead of consuming it, then the 
Woody StyleSheets were modified to recognise that tag, Woody could 
handle this WAI issue out of the box.

Issue (2), placeholder text, is slightly more complicated. I think we 
would have to introduce the concept of a default value to Woody's field 
markup, with the *option* to automatically invalidate fields which had 
their default values in.

Furthermore, I suspect it would be best if such fields had JavaScript 
like the following in them, when they have been populated with a 
default value that is not allowed by the validation:

<input name="sample-field"
	value="default value"
	onfocus="if (this.value == 'default value') this.value = '';"
	onblur="if (this.value == '') this.value = 'default value';"
	etc.
/>

Issue (3) making sure tables have summaries is easy:

	<table summary="this is a summary of the table's contents">

Several widgets in Woody make Tables, I propose that their 'hint' could 
be used as the summary.


WDYT folks?

Objections, suggestions etc. welcome

regards Jeremy

Re: Woody and WAI

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On 15 Jan 2004, at 20:52, Joerg Heinicke wrote:

> On 15.01.2004 21:17, Jeremy Quinn wrote:
>
>> 1) Provide an explicit label for each form control. (Level 2)
>
> AFAIK this is already done.

By looking at the Woody XSLTs there are *some* conditions under which 
<label>s are linked to <input>s, but not all.

ie. if you output certain types of <wi:group>.

However, many of the Woody samples do not get <label>s added.

eg. if you have a template snippet like this:

<tr valign="baseline">
   <td align="right"><wt:widget-label id="firstname"/>:</td>
   <td><wt:widget id="firstname"/></td>
</tr>

no <label> is added, whereas if the <wt:widget-label> were to be passed 
through to the XSLT layer, then all usage could have <label>s.

Another issue about adding labels, is that it becomes easier to do 
without Tables for containing forms, having the label makes it a lot 
easier to layout tabular forms using CSS.

>> 2) Include default, place-holding characters in edit boxes and text 
>> areas. (Level 3)
>
> The validation depends on whether it is only a hint or really a 
> default value.

Hence, I think, the need to add semantics to handle this to the Woody 
ML.
Does something like this make any sense?

<wd:field id="firstname" required="true">
   <wd:label><i18n:text 
i18n:catalogue="local">label.firstname</i18n:text></wd:label>
   <wd:hint><i18n:text 
i18n:catalogue="local">hint.firstname</i18n:text></wd:hint>
* <wd:default><i18n:text 
i18n:catalogue="local">default.firstname</i18n:text></wd:default>
   <wd:datatype base="string">
     <wd:validation>
*     <wd:default-value isvalid="false"/>
       <wd:length min="2" max="128"/>
     </wd:validation>
   </wd:datatype>
</wd:field>

>> 3) Provide a summary for tables. (Level 3)
>
> Yes, that should be easy.

Yes

regards Jeremy

Re: Woody and WAI

Posted by Joerg Heinicke <jo...@gmx.de>.
On 15.01.2004 21:17, Jeremy Quinn wrote:

> 1) Provide an explicit label for each form control. (Level 2)

AFAIK this is already done.

> 2) Include default, place-holding characters in edit boxes and text 
> areas. (Level 3)

The validation depends on whether it is only a hint or really a default 
value.

> 3) Provide a summary for tables. (Level 3)

Yes, that should be easy.

Joerg


Re: Woody and WAI

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On 15 Jan 2004, at 22:15, Tony Collen wrote:

> Jeremy Quinn wrote:
>
>> Hi All,
>>
>> I am in the process of getting some Woody forms approved as WAI 
>> compliant.
>>
>>     http://www.w3.org/WAI/
>>
>> While WAI may not be everybody's cup of tea ..... in certain sectors 
>> it is a common requirement .... and it is certainly not a bad selling 
>> point.
>>
>>
>> There are three issues which come up regularly with basic Woody forms:
>>
>> 1) Provide an explicit label for each form control. (Level 2)
>> 2) Include default, place-holding characters in edit boxes and text 
>> areas. (Level 3)
>> 3) Provide a summary for tables. (Level 3)
>>
>>
>
> <snip>
>
>> Issue (2), placeholder text, is slightly more complicated. I think we 
>> would have to introduce the concept of a default value to Woody's 
>> field markup, with the *option* to automatically invalidate fields 
>> which had their default values in.
>>
> This would be nice, I know there's a lot of work left to go on the 
> client-side aspect of Woody/CForms.
>
> As far as setting default values in a form, you can do something like 
> this in your flow:
>
> bean = new Packages.foo.myBean();
> bean.setBlah("default value");
> form.load(bean);
> form.showForm("whatever");
>
> It would be nice to be able to set a default value for a field however.

Definitely

I think it is nice to have it in the Form Model, as you will probably 
want to i18n the default.

And you need to cope with validation ..... is the default value a valid 
value or not.

This /can/ be handled in Flow but requires a lot of extra work with 
custom validation .... and becomes a lot more complicated where i18n is 
involved.

>> Furthermore, I suspect it would be best if such fields had JavaScript 
>> like the following in them, when they have been populated with a 
>> default value that is not allowed by the validation:
>>
>> <input name="sample-field"
>>     value="default value"
>>     onfocus="if (this.value == 'default value') this.value = '';"
>>     onblur="if (this.value == '') this.value = 'default value';"
>>     etc.
>> />
>>
>> Issue (3) making sure tables have summaries is easy:
>>
>>     <table summary="this is a summary of the table's contents">
>>
>> Several widgets in Woody make Tables, I propose that their 'hint' 
>> could be used as the summary.
>
>
> +1 for the hint going into the table summary.

cool

regards Jeremy

Re: Woody and WAI

Posted by Tony Collen <co...@umn.edu>.
Jeremy Quinn wrote:

> Hi All,
>
> I am in the process of getting some Woody forms approved as WAI 
> compliant.
>
>     http://www.w3.org/WAI/
>
> While WAI may not be everybody's cup of tea ..... in certain sectors 
> it is a common requirement .... and it is certainly not a bad selling 
> point.
>
>
> There are three issues which come up regularly with basic Woody forms:
>
> 1) Provide an explicit label for each form control. (Level 2)
> 2) Include default, place-holding characters in edit boxes and text 
> areas. (Level 3)
> 3) Provide a summary for tables. (Level 3)
>
>

<snip>

> Issue (2), placeholder text, is slightly more complicated. I think we 
> would have to introduce the concept of a default value to Woody's 
> field markup, with the *option* to automatically invalidate fields 
> which had their default values in.
>
This would be nice, I know there's a lot of work left to go on the 
client-side aspect of Woody/CForms.

As far as setting default values in a form, you can do something like 
this in your flow:

bean = new Packages.foo.myBean();
bean.setBlah("default value");
form.load(bean);
form.showForm("whatever");

It would be nice to be able to set a default value for a field however.

> Furthermore, I suspect it would be best if such fields had JavaScript 
> like the following in them, when they have been populated with a 
> default value that is not allowed by the validation:
>
> <input name="sample-field"
>     value="default value"
>     onfocus="if (this.value == 'default value') this.value = '';"
>     onblur="if (this.value == '') this.value = 'default value';"
>     etc.
> />
>
> Issue (3) making sure tables have summaries is easy:
>
>     <table summary="this is a summary of the table's contents">
>
> Several widgets in Woody make Tables, I propose that their 'hint' 
> could be used as the summary.


+1 for the hint going into the table summary.

Tony