You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ned Collyer <ne...@gmail.com> on 2008/11/24 01:56:09 UTC

Labelling/standard layout for form components.

I'm looking for suggestions on various ways of handling form layout -
specifically auto generating labels for form components, and the associated
markup surrounding the form fields.

I've currently got a system in place that allows you to add the fields very 
simply, and then uses a technique similar to "forms with flair"
http://londonwicket.org/content/LondonWicket-FormsWithFlair.pdf to add the
labels, error messages and standard markup.

What this gives us is a means for developers to have accessible standards
compliant forms (all labelled and linked) without each dev having to
manually add the appropriate markup structure.

Eg,
Java:
Form form = new Form("form", new PersonModel());
form.add(new TextField("name"));
form.add(new CheckBoxMultipleChoice("breakfasts",
breakfastList).setRequired(true));
form.visitFormComponents(new MyLabelMakerOfAwesome());
add(form);

Wicket Html:
<form wicket:id="form">
<input type="text" wicket:id="name" />
<wicket:container wicket:id="breakfasts" />
</form>

Actual output
<form>
<div class="form-field">
    <label for="name">Name</label>
    <input type="text" name="name" value="" id="name"/>
</div>
<div class="form-field">
	<fieldset>
			<legend>Breakfasts <em class="required">*</em></legend>
			<ul>
			   <li><label>Egg	<input type="checkbox" name="breakfasts"
/></label></li>
			   <li><label>Bacon	<input type="checkbox" name="breakfasts"
/></label></li>
			   <li><label>Toast	<input type="checkbox" name="breakfasts"
/></label></li>
			</ul>
	</fieldset>
</div>
</form>

Manual markup of each form is a common point of failure, especially with
hundreds of fields and tens of developers.

This works well in MOST circumstances... except when you want to work
outside of the default.

I am looking for a solution that will allow me to:
a/ embed 3rd party components without them being effected (eg, the
calendar/datepicker controls).
b/ be able to update the LABELS only with Ajax - without replacing the
field.
c/ easily exclude fields from the default.
d/ be able to add new fields to the form with Ajax (currently fields added
like this are not effected by the visitor).

I'd love some ideas re: the best way of achieving this.  I'm not asking for
code :) just ideas.

I think it could be very useful - especially if the markup is easily changed
to meet individual project requirements, and definitely gives a more DRY
approach to forms.

ps, i wrote this all in a simple text editor so if there are any flaws, I
hope the message is still communicated ;)
-- 
View this message in context: http://www.nabble.com/Labelling-standard-layout-for-form-components.-tp20653187p20653187.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Labelling/standard layout for form components.

Posted by James Carman <ja...@carmanconsulting.com>.
It's Apache 2 licensed.  I'll try to update the header soon.  If the
pom.xml file doesn't have it, then I'll add it there too


On Mon, Nov 24, 2008 at 5:30 PM, Ned Collyer <ne...@gmail.com> wrote:
>
> Great :) I might hit you up on that sometime soon.  I think everyone has
> deadlines looming - its the nature of IT.
>
> What is the license?  I see 3 mentions of Apache in the form classes, but
> thats about it.
>
> Rgds
>
> Ned
>
>
> jwcarman wrote:
>>
>> By the way, you're more than welcome to help out with wicketopia if
>> you want.  Nino and I are working on it thus far.  I've just not had
>> much time to do anything with it.  Our project at work is releasing
>> very soon, so it's crunch time! :)
>>
>> On Sun, Nov 23, 2008 at 11:00 PM, Ned Collyer <ne...@gmail.com>
>> wrote:
>>>
>>> Thanks!  This has given some good ideas :) Love the central place with
>>> the
>>> fragment doing the layout - did a similar thing with a bean editor a
>>> while
>>> back (again similar to whats available on londonwicket.org).
>>>
>>> Thanks for your input.
>>
>
> --
> View this message in context: http://www.nabble.com/Labelling-standard-layout-for-form-components.-tp20653187p20671342.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Labelling/standard layout for form components.

Posted by Ned Collyer <ne...@gmail.com>.
Great :) I might hit you up on that sometime soon.  I think everyone has
deadlines looming - its the nature of IT.

What is the license?  I see 3 mentions of Apache in the form classes, but
thats about it.

Rgds

Ned


jwcarman wrote:
> 
> By the way, you're more than welcome to help out with wicketopia if
> you want.  Nino and I are working on it thus far.  I've just not had
> much time to do anything with it.  Our project at work is releasing
> very soon, so it's crunch time! :)
> 
> On Sun, Nov 23, 2008 at 11:00 PM, Ned Collyer <ne...@gmail.com>
> wrote:
>>
>> Thanks!  This has given some good ideas :) Love the central place with
>> the
>> fragment doing the layout - did a similar thing with a bean editor a
>> while
>> back (again similar to whats available on londonwicket.org).
>>
>> Thanks for your input.
> 

-- 
View this message in context: http://www.nabble.com/Labelling-standard-layout-for-form-components.-tp20653187p20671342.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Labelling/standard layout for form components.

Posted by James Carman <ja...@carmanconsulting.com>.
By the way, you're more than welcome to help out with wicketopia if
you want.  Nino and I are working on it thus far.  I've just not had
much time to do anything with it.  Our project at work is releasing
very soon, so it's crunch time! :)

On Sun, Nov 23, 2008 at 11:00 PM, Ned Collyer <ne...@gmail.com> wrote:
>
> Thanks!  This has given some good ideas :) Love the central place with the
> fragment doing the layout - did a similar thing with a bean editor a while
> back (again similar to whats available on londonwicket.org).
>
> Thanks for your input.
>
>
> jwcarman wrote:
>>
>> The wicketopia project has a mechanism for automagically creating
>> labels for bean properties.
>>
>> http://wicketopia.sourceforge.net
>>
>> Take a look at PropertyLabel and PropertyLabelModel (there should be test
>> cases)
>>
>
> --
> View this message in context: http://www.nabble.com/Labelling-standard-layout-for-form-components.-tp20653187p20654547.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Labelling/standard layout for form components.

Posted by Ned Collyer <ne...@gmail.com>.
Thanks!  This has given some good ideas :) Love the central place with the
fragment doing the layout - did a similar thing with a bean editor a while
back (again similar to whats available on londonwicket.org).

Thanks for your input.


jwcarman wrote:
> 
> The wicketopia project has a mechanism for automagically creating
> labels for bean properties.
> 
> http://wicketopia.sourceforge.net
> 
> Take a look at PropertyLabel and PropertyLabelModel (there should be test
> cases)
> 

-- 
View this message in context: http://www.nabble.com/Labelling-standard-layout-for-form-components.-tp20653187p20654547.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Labelling/standard layout for form components.

Posted by James Carman <ja...@carmanconsulting.com>.
The wicketopia project has a mechanism for automagically creating
labels for bean properties.

http://wicketopia.sourceforge.net

Take a look at PropertyLabel and PropertyLabelModel (there should be test cases)

On Sun, Nov 23, 2008 at 7:56 PM, Ned Collyer <ne...@gmail.com> wrote:
>
> I'm looking for suggestions on various ways of handling form layout -
> specifically auto generating labels for form components, and the associated
> markup surrounding the form fields.
>
> I've currently got a system in place that allows you to add the fields very
> simply, and then uses a technique similar to "forms with flair"
> http://londonwicket.org/content/LondonWicket-FormsWithFlair.pdf to add the
> labels, error messages and standard markup.
>
> What this gives us is a means for developers to have accessible standards
> compliant forms (all labelled and linked) without each dev having to
> manually add the appropriate markup structure.
>
> Eg,
> Java:
> Form form = new Form("form", new PersonModel());
> form.add(new TextField("name"));
> form.add(new CheckBoxMultipleChoice("breakfasts",
> breakfastList).setRequired(true));
> form.visitFormComponents(new MyLabelMakerOfAwesome());
> add(form);
>
> Wicket Html:
> <form wicket:id="form">
> <input type="text" wicket:id="name" />
> <wicket:container wicket:id="breakfasts" />
> </form>
>
> Actual output
> <form>
> <div class="form-field">
>    <label for="name">Name</label>
>    <input type="text" name="name" value="" id="name"/>
> </div>
> <div class="form-field">
>        <fieldset>
>                        <legend>Breakfasts <em class="required">*</em></legend>
>                        <ul>
>                           <li><label>Egg       <input type="checkbox" name="breakfasts"
> /></label></li>
>                           <li><label>Bacon     <input type="checkbox" name="breakfasts"
> /></label></li>
>                           <li><label>Toast     <input type="checkbox" name="breakfasts"
> /></label></li>
>                        </ul>
>        </fieldset>
> </div>
> </form>
>
> Manual markup of each form is a common point of failure, especially with
> hundreds of fields and tens of developers.
>
> This works well in MOST circumstances... except when you want to work
> outside of the default.
>
> I am looking for a solution that will allow me to:
> a/ embed 3rd party components without them being effected (eg, the
> calendar/datepicker controls).
> b/ be able to update the LABELS only with Ajax - without replacing the
> field.
> c/ easily exclude fields from the default.
> d/ be able to add new fields to the form with Ajax (currently fields added
> like this are not effected by the visitor).
>
> I'd love some ideas re: the best way of achieving this.  I'm not asking for
> code :) just ideas.
>
> I think it could be very useful - especially if the markup is easily changed
> to meet individual project requirements, and definitely gives a more DRY
> approach to forms.
>
> ps, i wrote this all in a simple text editor so if there are any flaws, I
> hope the message is still communicated ;)
> --
> View this message in context: http://www.nabble.com/Labelling-standard-layout-for-form-components.-tp20653187p20653187.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Labelling/standard layout for form components.

Posted by Ned Collyer <ne...@gmail.com>.
My initial thinking is I'm thinking I'll have to roll my own form elements.
-- 
View this message in context: http://www.nabble.com/Labelling-standard-layout-for-form-components.-tp20653187p20654098.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org