+1 that's a pretty frequent usecase

Am 13.12.2009 um 14:17 schrieb John Krasnay:

> +1, great idea!
> 
> jk
> 
> On Sun, Dec 13, 2009 at 02:06:05PM +0100, Erik van Oosten wrote:
>> Hi,
>> 
>> In the many Wicket applications I have seen, the most frequent error is  
>> to not correctly set the 'for' attribute of an HTML 'label' element.  
>> Currently it is necessary to do this from code. Although a quickly  
>> written component will make this fairly easy, the task is occurring that  
>> often that imho better support by wicket is warranted.
>> 
>> I therefore propose a new wicket:for attribute that looks as follows:
>> 
>> <label *wicket:for="name"*>Name</label>
>> <input wicket:id="name" type="text"/>
>> 
>> The rendered markup could for example be:
>> 
>> <label for="name78">Name</label>
>> <input id="name78" name="name78" type="text" value="..."/>
>> 
>> Some more thoughts on the design of the wicket:for attribute:
>> - The value of the attribute refers to a component by component id. The  
>> referred component must be a sibling of the same container that provides  
>> the markup with the label element. Referring to a component outside this  
>> container is tricky as then component ids are no longer unique.
>> - The wicket:for attribute will render the 'for' attribute with the  
>> markup id of the referenced component as value.
>> - The method setOuputMarkupId(true) will be called on the referenced  
>> component.
>> 
>> More ideas?
>> If I would implement such a wicket:for attribute, would it be accepted  
>> in Wicket core?
>> 
>> Regards,
>>   Erik.
>> 
>> 
>> -- 
>> Erik van Oosten
>> http://day-to-day-stuff.blogspot.com/
>> 
>> 

Reply via email to