Re: Is there something like ValidationDelegates in Wicket?

2007-08-17 Thread Onno Scheffers

Hi Igor,

does this mean that you wrote a Border component that handles multiple 
formcomponents at once? Or that you wrote a Border component that 
handles only one formcomponent at a time (like the 
FormComponentFeedbackBorder)?
The first is what I've been trying to figure out, because I find the 
second way of doing it very code-intensive in both Markup and Java code. 
I could use some example code if that's possible, since I haven't been 
able to figure out how to do it.
I can visit all formComponents (getForm().visitFormComponents()) but 
adding new components to them during rendering is not possible if I'm 
not mistaken?


Regards,

Onno


yep, i have a border implementation that does just this.

it searches its hierarchy for a formcomponent(s) and adds labels, then if
there are any errors it renders them after the component. so it is
definetely possible, you still have to add a border/component but the
chances are you are adding a label/component anyways.
  





-igor


On 8/16/07, Scott Swank [EMAIL PROTECTED] wrote:
  

Look at Borders


http://wicketstuff.org/wicket13/compref/?wicket:bookmarkablePage=%3Aorg.apache.wicket.examples.compref.BorderPage

Particular the FormComponentFeedbackBorder.


On 8/16/07, Onno Scheffers [EMAIL PROTECTED] wrote:


Hi,

I'm new to Wicket. I worked with Tapestry before and I was wondering if
there's something like the Tapestry ValidationDelegate available in
  

Wicket?


By adding a ValidationDelegate to a form I was able to override methods
like writeLabelPrefix, writeLabelSuffix, writePrefix and writeSuffix.
That made it very easy to add a '*' behind each component in the form if
it was required and when it was in error I could automatically render
the error-message behind the component and apply an error-style to the
label of that component.
It made life much easier and saved a lot of code.

So far the only way I've been able to get error-messages to render
behind component in Wicket is by using a custom component that I
manually have to add after each component to both the template and to
the Java code. I haven't yet found a way to add behaviors to components
or forms that can render this kind of markup behind an existing
component or its label.

Rendering error-messages behind components is quite common and I'm a
Wicket newbie, so I'm sure I must have overlooked something. Any help
would be appreciated.

regards,

Onno


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  

--
Scott Swank
reformed mathematician

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Is there something like ValidationDelegates in Wicket?

2007-08-17 Thread Igor Vaynberg
my border handles multiple formcomponetns if they are meant to be grouped.
for example you can add 3 textfields and it will create labels like:

city/state/zip [text1][text2][text3] errors for text1/text2/text3

i have a utility method in my Form subclass addWithBorder(String borderid,
FormComponent... fcs)

so my code usually looks like:

addWithBorder(nameborder, new
TextField(name).setRequired(true).setLabel(new ResourceModel(user.name
));
and in markup: div wicket:id=nameborderinput type=text
wicket:id=name//div

the border will then generate
tdlabel for=namename/label/tdtdinput type=text id=name ...
/ [any errors]/td

unfortunately i can post the code for it, but it isnt very complicated

-igor




On 8/17/07, Onno Scheffers [EMAIL PROTECTED] wrote:

 Hi Igor,

 does this mean that you wrote a Border component that handles multiple
 formcomponents at once? Or that you wrote a Border component that
 handles only one formcomponent at a time (like the
 FormComponentFeedbackBorder)?
 The first is what I've been trying to figure out, because I find the
 second way of doing it very code-intensive in both Markup and Java code.
 I could use some example code if that's possible, since I haven't been
 able to figure out how to do it.
 I can visit all formComponents (getForm().visitFormComponents()) but
 adding new components to them during rendering is not possible if I'm
 not mistaken?

 Regards,

 Onno

  yep, i have a border implementation that does just this.
 
  it searches its hierarchy for a formcomponent(s) and adds labels, then
 if
  there are any errors it renders them after the component. so it is
  definetely possible, you still have to add a border/component but the
  chances are you are adding a label/component anyways.
 



  -igor
 
 
  On 8/16/07, Scott Swank [EMAIL PROTECTED] wrote:
 
  Look at Borders
 
 
 
 http://wicketstuff.org/wicket13/compref/?wicket:bookmarkablePage=%3Aorg.apache.wicket.examples.compref.BorderPage
 
  Particular the FormComponentFeedbackBorder.
 
 
  On 8/16/07, Onno Scheffers [EMAIL PROTECTED] wrote:
 
  Hi,
 
  I'm new to Wicket. I worked with Tapestry before and I was wondering
 if
  there's something like the Tapestry ValidationDelegate available in
 
  Wicket?
 
  By adding a ValidationDelegate to a form I was able to override
 methods
  like writeLabelPrefix, writeLabelSuffix, writePrefix and writeSuffix.
  That made it very easy to add a '*' behind each component in the form
 if
  it was required and when it was in error I could automatically render
  the error-message behind the component and apply an error-style to the
  label of that component.
  It made life much easier and saved a lot of code.
 
  So far the only way I've been able to get error-messages to render
  behind component in Wicket is by using a custom component that I
  manually have to add after each component to both the template and to
  the Java code. I haven't yet found a way to add behaviors to
 components
  or forms that can render this kind of markup behind an existing
  component or its label.
 
  Rendering error-messages behind components is quite common and I'm a
  Wicket newbie, so I'm sure I must have overlooked something. Any help
  would be appreciated.
 
  regards,
 
  Onno
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
  --
  Scott Swank
  reformed mathematician
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Is there something like ValidationDelegates in Wicket?

2007-08-16 Thread Onno Scheffers

Hi,

I'm new to Wicket. I worked with Tapestry before and I was wondering if 
there's something like the Tapestry ValidationDelegate available in Wicket?


By adding a ValidationDelegate to a form I was able to override methods 
like writeLabelPrefix, writeLabelSuffix, writePrefix and writeSuffix. 
That made it very easy to add a '*' behind each component in the form if 
it was required and when it was in error I could automatically render 
the error-message behind the component and apply an error-style to the 
label of that component.

It made life much easier and saved a lot of code.

So far the only way I've been able to get error-messages to render 
behind component in Wicket is by using a custom component that I 
manually have to add after each component to both the template and to 
the Java code. I haven't yet found a way to add behaviors to components 
or forms that can render this kind of markup behind an existing 
component or its label.


Rendering error-messages behind components is quite common and I'm a 
Wicket newbie, so I'm sure I must have overlooked something. Any help 
would be appreciated.


regards,

Onno


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Is there something like ValidationDelegates in Wicket?

2007-08-16 Thread Igor Vaynberg
yep, i have a border implementation that does just this.

it searches its hierarchy for a formcomponent(s) and adds labels, then if
there are any errors it renders them after the component. so it is
definetely possible, you still have to add a border/component but the
chances are you are adding a label/component anyways.

-igor


On 8/16/07, Scott Swank [EMAIL PROTECTED] wrote:

 Look at Borders


 http://wicketstuff.org/wicket13/compref/?wicket:bookmarkablePage=%3Aorg.apache.wicket.examples.compref.BorderPage

 Particular the FormComponentFeedbackBorder.


 On 8/16/07, Onno Scheffers [EMAIL PROTECTED] wrote:
  Hi,
 
  I'm new to Wicket. I worked with Tapestry before and I was wondering if
  there's something like the Tapestry ValidationDelegate available in
 Wicket?
 
  By adding a ValidationDelegate to a form I was able to override methods
  like writeLabelPrefix, writeLabelSuffix, writePrefix and writeSuffix.
  That made it very easy to add a '*' behind each component in the form if
  it was required and when it was in error I could automatically render
  the error-message behind the component and apply an error-style to the
  label of that component.
  It made life much easier and saved a lot of code.
 
  So far the only way I've been able to get error-messages to render
  behind component in Wicket is by using a custom component that I
  manually have to add after each component to both the template and to
  the Java code. I haven't yet found a way to add behaviors to components
  or forms that can render this kind of markup behind an existing
  component or its label.
 
  Rendering error-messages behind components is quite common and I'm a
  Wicket newbie, so I'm sure I must have overlooked something. Any help
  would be appreciated.
 
  regards,
 
  Onno
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


 --
 Scott Swank
 reformed mathematician

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]