Re: Feedback message is not available for behaviors added to nested form components

2013-07-04 Thread James Selvakumar
Thanks Jesse & Sven for your explanations.
It worked like a charm after I set ListView#setReuseItems(true)
Thank you very much.


On Wed, Jul 3, 2013 at 3:12 PM, Jesse Long  wrote:

> Hi James,
>
> This is a shortened list of events happening, including only the ones
> affecting you. They are in the order in which they occur.
>
>  * IFormSubmitListener#**onFormSubmitted()
>  * ListView#onBeforeRender()
>  * Page#onRender()
>
> ListView#onBeforeRender() calls ListView#onPopulate(). If you are not
> using ListView#setReuseItems(true), then ListView#onPopulate() removes all
> children of ListView and re-creates them.
>
> So, the children of ListView that are present during Page#onRender() are
> not the same children that were present during 
> IFormSubmitListener#**onFormSubmitted(),
> and hence not the same children that had the feedback messages.
>
> Cheers,
> Jesse
>
>
> On 03/07/2013 02:35, James Selvakumar wrote:
>
>> No.
>>
>>
>> On Tue, Jul 2, 2013 at 7:04 PM, Sven Meier  wrote:
>>
>>  Are you using listView.setReuseItems(true) ?
>>>
>>> Sven
>>>
>>>
>>> On 07/02/2013 11:13 AM, James Selvakumar wrote:
>>>
>>>  Hi all,

 I've the following component heirarchy:

 form:textField
 form:listView:panel-1:panel1DropDownChoice

 form:submitButton

 I've marked the all the form components as required.

 I also have a behavior that is added to all the form components (via
 IVisitor) which will make the respective feedback messages appear under
 the
 form components.

 It works perfectly for the form component "texField" which is directly
 attached to the form.

 However it doesn't work for for "panel1DropDownChoice".

 I've added some debug messages in the "validate()" method of
 "panel1DropDownChoice" and found that feedback messages are indeed
 generated.

 However from the debug messages in my behavior, I found that feedback
 messages were some how lost.

 This is the behavior I'm using. (Thanks London Wicket users)

 *public class ValidationMsgBehavior extends Behavior

 {
   private static Logger logger =
 LoggerFactory.getLogger(ValidationMsgBehavior.class);


   @Override
   public void afterRender(Component c)
   {
   logger.debug("Preparing to add validation msg for the
 component
 {}", c);
   FormComponent fc = (FormComponent) c;
   if (!fc.isValid()) {
   String error;
   if (fc.hasFeedbackMessage()) {
   logger.debug("Form component {} has feedback
 messages",
 fc);
   error =
 fc.getFeedbackMessages().first(FeedbackMessage.ERROR).

 getMessage().toString();
   } else {
   error = "Your input is invalid.";
   }
   fc.getResponse().write(
   "" + error + "");
   }else{
   logger.debug("Form component {} is valid", fc);
   }
   }
 }*

 Any clues? I've been trying to crack this for a whole day.


  --**
>>> --**-
>>> To unsubscribe, e-mail: 
>>> users-unsubscribe@wicket.**apa**che.org
>>> 
>>> >
>>>
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>>
>>
>


-- 
Thanks & regards
James Selvakumar
mCruncher


Re: Feedback message is not available for behaviors added to nested form components

2013-07-04 Thread James Selvakumar
Hi Sven,

I'm sorry I'm not adding components but I update the model so that the
ListView generates the components dynamically.


On Thu, Jul 4, 2013 at 3:16 PM, Sven Meier  wrote:

> Hi,
>
> ListView will create components for you based on the contents of the
> model. Why are you adding components?
>
> Sven
>
>
> On 07/04/2013 02:41 AM, James Selvakumar wrote:
>
>> Hi Jesse,
>>
>> I was not aware of this before. Thanks for the insight
>> But I do add/remove components to the ListView dynamically.
>> Will ListView#setReuseItems(true) affect that?
>>
>>
>> On Wed, Jul 3, 2013 at 3:12 PM, Jesse Long  wrote:
>>
>>  Hi James,
>>>
>>> This is a shortened list of events happening, including only the ones
>>> affecting you. They are in the order in which they occur.
>>>
>>>   * IFormSubmitListener#onFormSubmitted()
>>>
>>>   * ListView#onBeforeRender()
>>>   * Page#onRender()
>>>
>>> ListView#onBeforeRender() calls ListView#onPopulate(). If you are not
>>> using ListView#setReuseItems(true), then ListView#onPopulate() removes
>>> all
>>> children of ListView and re-creates them.
>>>
>>> So, the children of ListView that are present during Page#onRender() are
>>> not the same children that were present during IFormSubmitListener#
>>> onFormSubmitted(),
>>>
>>> and hence not the same children that had the feedback messages.
>>>
>>> Cheers,
>>> Jesse
>>>
>>>
>>> On 03/07/2013 02:35, James Selvakumar wrote:
>>>
>>>  No.


 On Tue, Jul 2, 2013 at 7:04 PM, Sven Meier  wrote:

   Are you using listView.setReuseItems(true) ?

> Sven
>
>
> On 07/02/2013 11:13 AM, James Selvakumar wrote:
>
>   Hi all,
>
>> I've the following component heirarchy:
>>
>> form:textField
>> form:listView:panel-1:**panel1DropDownChoice
>>
>>
>> form:submitButton
>>
>> I've marked the all the form components as required.
>>
>> I also have a behavior that is added to all the form components (via
>> IVisitor) which will make the respective feedback messages appear
>> under
>> the
>> form components.
>>
>> It works perfectly for the form component "texField" which is directly
>> attached to the form.
>>
>> However it doesn't work for for "panel1DropDownChoice".
>>
>> I've added some debug messages in the "validate()" method of
>> "panel1DropDownChoice" and found that feedback messages are indeed
>> generated.
>>
>> However from the debug messages in my behavior, I found that feedback
>> messages were some how lost.
>>
>> This is the behavior I'm using. (Thanks London Wicket users)
>>
>> *public class ValidationMsgBehavior extends Behavior
>>
>> {
>>private static Logger logger =
>> LoggerFactory.getLogger(**ValidationMsgBehavior.class);
>>
>>
>>
>>@Override
>>public void afterRender(Component c)
>>{
>>logger.debug("Preparing to add validation msg for the
>> component
>> {}", c);
>>FormComponent fc = (FormComponent) c;
>>if (!fc.isValid()) {
>>String error;
>>if (fc.hasFeedbackMessage()) {
>>logger.debug("Form component {} has feedback
>> messages",
>> fc);
>>error =
>> fc.getFeedbackMessages().**first(FeedbackMessage.ERROR).**
>>
>>
>> getMessage().toString();
>>} else {
>>error = "Your input is invalid.";
>>}
>>fc.getResponse().write(
>>"" + error +
>> "");
>>}else{
>>logger.debug("Form component {} is valid", fc);
>>}
>>}
>> }*
>>
>> Any clues? I've been trying to crack this for a whole day.
>>
>>
>>   --**--**
>> --**
>>
> --**-
> To unsubscribe, e-mail: users-unsubscribe@wicket.apa**che.org<
> http://apache.org**>
> http://wicket.apache.org><
> users-unsubscribe@**wicket.apache.org
> >
>
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>
>
>
>>
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
>
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Thanks & regards
James Selvakumar
mCruncher


Re: Feedback message is not available for behaviors added to nested form components

2013-07-04 Thread Sven Meier

Hi,

ListView will create components for you based on the contents of the 
model. Why are you adding components?


Sven

On 07/04/2013 02:41 AM, James Selvakumar wrote:

Hi Jesse,

I was not aware of this before. Thanks for the insight
But I do add/remove components to the ListView dynamically.
Will ListView#setReuseItems(true) affect that?


On Wed, Jul 3, 2013 at 3:12 PM, Jesse Long  wrote:


Hi James,

This is a shortened list of events happening, including only the ones
affecting you. They are in the order in which they occur.

  * IFormSubmitListener#**onFormSubmitted()
  * ListView#onBeforeRender()
  * Page#onRender()

ListView#onBeforeRender() calls ListView#onPopulate(). If you are not
using ListView#setReuseItems(true), then ListView#onPopulate() removes all
children of ListView and re-creates them.

So, the children of ListView that are present during Page#onRender() are
not the same children that were present during 
IFormSubmitListener#**onFormSubmitted(),
and hence not the same children that had the feedback messages.

Cheers,
Jesse


On 03/07/2013 02:35, James Selvakumar wrote:


No.


On Tue, Jul 2, 2013 at 7:04 PM, Sven Meier  wrote:

  Are you using listView.setReuseItems(true) ?

Sven


On 07/02/2013 11:13 AM, James Selvakumar wrote:

  Hi all,

I've the following component heirarchy:

form:textField
form:listView:panel-1:panel1DropDownChoice

form:submitButton

I've marked the all the form components as required.

I also have a behavior that is added to all the form components (via
IVisitor) which will make the respective feedback messages appear under
the
form components.

It works perfectly for the form component "texField" which is directly
attached to the form.

However it doesn't work for for "panel1DropDownChoice".

I've added some debug messages in the "validate()" method of
"panel1DropDownChoice" and found that feedback messages are indeed
generated.

However from the debug messages in my behavior, I found that feedback
messages were some how lost.

This is the behavior I'm using. (Thanks London Wicket users)

*public class ValidationMsgBehavior extends Behavior

{
   private static Logger logger =
LoggerFactory.getLogger(ValidationMsgBehavior.class);


   @Override
   public void afterRender(Component c)
   {
   logger.debug("Preparing to add validation msg for the
component
{}", c);
   FormComponent fc = (FormComponent) c;
   if (!fc.isValid()) {
   String error;
   if (fc.hasFeedbackMessage()) {
   logger.debug("Form component {} has feedback
messages",
fc);
   error =
fc.getFeedbackMessages().first(FeedbackMessage.ERROR).

getMessage().toString();
   } else {
   error = "Your input is invalid.";
   }
   fc.getResponse().write(
   "" + error + "");
   }else{
   logger.debug("Form component {} is valid", fc);
   }
   }
}*

Any clues? I've been trying to crack this for a whole day.


  --**

--**-
To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apa**che.org

For additional commands, e-mail: users-h...@wicket.apache.org








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



Re: Feedback message is not available for behaviors added to nested form components

2013-07-03 Thread James Selvakumar
Hi Jesse,

I was not aware of this before. Thanks for the insight
But I do add/remove components to the ListView dynamically.
Will ListView#setReuseItems(true) affect that?


On Wed, Jul 3, 2013 at 3:12 PM, Jesse Long  wrote:

> Hi James,
>
> This is a shortened list of events happening, including only the ones
> affecting you. They are in the order in which they occur.
>
>  * IFormSubmitListener#**onFormSubmitted()
>  * ListView#onBeforeRender()
>  * Page#onRender()
>
> ListView#onBeforeRender() calls ListView#onPopulate(). If you are not
> using ListView#setReuseItems(true), then ListView#onPopulate() removes all
> children of ListView and re-creates them.
>
> So, the children of ListView that are present during Page#onRender() are
> not the same children that were present during 
> IFormSubmitListener#**onFormSubmitted(),
> and hence not the same children that had the feedback messages.
>
> Cheers,
> Jesse
>
>
> On 03/07/2013 02:35, James Selvakumar wrote:
>
>> No.
>>
>>
>> On Tue, Jul 2, 2013 at 7:04 PM, Sven Meier  wrote:
>>
>>  Are you using listView.setReuseItems(true) ?
>>>
>>> Sven
>>>
>>>
>>> On 07/02/2013 11:13 AM, James Selvakumar wrote:
>>>
>>>  Hi all,

 I've the following component heirarchy:

 form:textField
 form:listView:panel-1:panel1DropDownChoice

 form:submitButton

 I've marked the all the form components as required.

 I also have a behavior that is added to all the form components (via
 IVisitor) which will make the respective feedback messages appear under
 the
 form components.

 It works perfectly for the form component "texField" which is directly
 attached to the form.

 However it doesn't work for for "panel1DropDownChoice".

 I've added some debug messages in the "validate()" method of
 "panel1DropDownChoice" and found that feedback messages are indeed
 generated.

 However from the debug messages in my behavior, I found that feedback
 messages were some how lost.

 This is the behavior I'm using. (Thanks London Wicket users)

 *public class ValidationMsgBehavior extends Behavior

 {
   private static Logger logger =
 LoggerFactory.getLogger(ValidationMsgBehavior.class);


   @Override
   public void afterRender(Component c)
   {
   logger.debug("Preparing to add validation msg for the
 component
 {}", c);
   FormComponent fc = (FormComponent) c;
   if (!fc.isValid()) {
   String error;
   if (fc.hasFeedbackMessage()) {
   logger.debug("Form component {} has feedback
 messages",
 fc);
   error =
 fc.getFeedbackMessages().first(FeedbackMessage.ERROR).

 getMessage().toString();
   } else {
   error = "Your input is invalid.";
   }
   fc.getResponse().write(
   "" + error + "");
   }else{
   logger.debug("Form component {} is valid", fc);
   }
   }
 }*

 Any clues? I've been trying to crack this for a whole day.


  --**
>>> --**-
>>> To unsubscribe, e-mail: 
>>> users-unsubscribe@wicket.**apa**che.org
>>> 
>>> >
>>>
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>>
>>
>


-- 
Thanks & regards
James Selvakumar
mCruncher


Re: Feedback message is not available for behaviors added to nested form components

2013-07-03 Thread Jesse Long

Hi James,

This is a shortened list of events happening, including only the ones 
affecting you. They are in the order in which they occur.


 * IFormSubmitListener#onFormSubmitted()
 * ListView#onBeforeRender()
 * Page#onRender()

ListView#onBeforeRender() calls ListView#onPopulate(). If you are not 
using ListView#setReuseItems(true), then ListView#onPopulate() removes 
all children of ListView and re-creates them.


So, the children of ListView that are present during Page#onRender() are 
not the same children that were present during 
IFormSubmitListener#onFormSubmitted(), and hence not the same children 
that had the feedback messages.


Cheers,
Jesse

On 03/07/2013 02:35, James Selvakumar wrote:

No.


On Tue, Jul 2, 2013 at 7:04 PM, Sven Meier  wrote:


Are you using listView.setReuseItems(true) ?

Sven


On 07/02/2013 11:13 AM, James Selvakumar wrote:


Hi all,

I've the following component heirarchy:

form:textField
form:listView:panel-1:**panel1DropDownChoice
form:submitButton

I've marked the all the form components as required.

I also have a behavior that is added to all the form components (via
IVisitor) which will make the respective feedback messages appear under
the
form components.

It works perfectly for the form component "texField" which is directly
attached to the form.

However it doesn't work for for "panel1DropDownChoice".

I've added some debug messages in the "validate()" method of
"panel1DropDownChoice" and found that feedback messages are indeed
generated.

However from the debug messages in my behavior, I found that feedback
messages were some how lost.

This is the behavior I'm using. (Thanks London Wicket users)

*public class ValidationMsgBehavior extends Behavior

{
  private static Logger logger =
LoggerFactory.getLogger(**ValidationMsgBehavior.class);

  @Override
  public void afterRender(Component c)
  {
  logger.debug("Preparing to add validation msg for the component
{}", c);
  FormComponent fc = (FormComponent) c;
  if (!fc.isValid()) {
  String error;
  if (fc.hasFeedbackMessage()) {
  logger.debug("Form component {} has feedback messages",
fc);
  error =
fc.getFeedbackMessages().**first(FeedbackMessage.ERROR).**
getMessage().toString();
  } else {
  error = "Your input is invalid.";
  }
  fc.getResponse().write(
  "" + error + "");
  }else{
  logger.debug("Form component {} is valid", fc);
  }
  }
}*

Any clues? I've been trying to crack this for a whole day.



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








Re: Feedback message is not available for behaviors added to nested form components

2013-07-02 Thread James Selvakumar
No.


On Tue, Jul 2, 2013 at 7:04 PM, Sven Meier  wrote:

> Are you using listView.setReuseItems(true) ?
>
> Sven
>
>
> On 07/02/2013 11:13 AM, James Selvakumar wrote:
>
>> Hi all,
>>
>> I've the following component heirarchy:
>>
>> form:textField
>> form:listView:panel-1:**panel1DropDownChoice
>> form:submitButton
>>
>> I've marked the all the form components as required.
>>
>> I also have a behavior that is added to all the form components (via
>> IVisitor) which will make the respective feedback messages appear under
>> the
>> form components.
>>
>> It works perfectly for the form component "texField" which is directly
>> attached to the form.
>>
>> However it doesn't work for for "panel1DropDownChoice".
>>
>> I've added some debug messages in the "validate()" method of
>> "panel1DropDownChoice" and found that feedback messages are indeed
>> generated.
>>
>> However from the debug messages in my behavior, I found that feedback
>> messages were some how lost.
>>
>> This is the behavior I'm using. (Thanks London Wicket users)
>>
>> *public class ValidationMsgBehavior extends Behavior
>>
>> {
>>  private static Logger logger =
>> LoggerFactory.getLogger(**ValidationMsgBehavior.class);
>>
>>  @Override
>>  public void afterRender(Component c)
>>  {
>>  logger.debug("Preparing to add validation msg for the component
>> {}", c);
>>  FormComponent fc = (FormComponent) c;
>>  if (!fc.isValid()) {
>>  String error;
>>  if (fc.hasFeedbackMessage()) {
>>  logger.debug("Form component {} has feedback messages",
>> fc);
>>  error =
>> fc.getFeedbackMessages().**first(FeedbackMessage.ERROR).**
>> getMessage().toString();
>>  } else {
>>  error = "Your input is invalid.";
>>  }
>>  fc.getResponse().write(
>>  "" + error + "");
>>  }else{
>>  logger.debug("Form component {} is valid", fc);
>>  }
>>  }
>> }*
>>
>> Any clues? I've been trying to crack this for a whole day.
>>
>>
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Thanks & regards
James Selvakumar
mCruncher


Re: Feedback message is not available for behaviors added to nested form components

2013-07-02 Thread Sven Meier

Are you using listView.setReuseItems(true) ?

Sven

On 07/02/2013 11:13 AM, James Selvakumar wrote:

Hi all,

I've the following component heirarchy:

form:textField
form:listView:panel-1:panel1DropDownChoice
form:submitButton

I've marked the all the form components as required.

I also have a behavior that is added to all the form components (via
IVisitor) which will make the respective feedback messages appear under the
form components.

It works perfectly for the form component "texField" which is directly
attached to the form.

However it doesn't work for for "panel1DropDownChoice".

I've added some debug messages in the "validate()" method of
"panel1DropDownChoice" and found that feedback messages are indeed
generated.

However from the debug messages in my behavior, I found that feedback
messages were some how lost.

This is the behavior I'm using. (Thanks London Wicket users)

*public class ValidationMsgBehavior extends Behavior
{
 private static Logger logger =
LoggerFactory.getLogger(ValidationMsgBehavior.class);

 @Override
 public void afterRender(Component c)
 {
 logger.debug("Preparing to add validation msg for the component
{}", c);
 FormComponent fc = (FormComponent) c;
 if (!fc.isValid()) {
 String error;
 if (fc.hasFeedbackMessage()) {
 logger.debug("Form component {} has feedback messages", fc);
 error =
fc.getFeedbackMessages().first(FeedbackMessage.ERROR).getMessage().toString();
 } else {
 error = "Your input is invalid.";
 }
 fc.getResponse().write(
 "" + error + "");
 }else{
 logger.debug("Form component {} is valid", fc);
 }
 }
}*

Any clues? I've been trying to crack this for a whole day.




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



Feedback message is not available for behaviors added to nested form components

2013-07-02 Thread James Selvakumar
Hi all,

I've the following component heirarchy:

form:textField
form:listView:panel-1:panel1DropDownChoice
form:submitButton

I've marked the all the form components as required.

I also have a behavior that is added to all the form components (via
IVisitor) which will make the respective feedback messages appear under the
form components.

It works perfectly for the form component "texField" which is directly
attached to the form.

However it doesn't work for for "panel1DropDownChoice".

I've added some debug messages in the "validate()" method of
"panel1DropDownChoice" and found that feedback messages are indeed
generated.

However from the debug messages in my behavior, I found that feedback
messages were some how lost.

This is the behavior I'm using. (Thanks London Wicket users)

*public class ValidationMsgBehavior extends Behavior
{
private static Logger logger =
LoggerFactory.getLogger(ValidationMsgBehavior.class);

@Override
public void afterRender(Component c)
{
logger.debug("Preparing to add validation msg for the component
{}", c);
FormComponent fc = (FormComponent) c;
if (!fc.isValid()) {
String error;
if (fc.hasFeedbackMessage()) {
logger.debug("Form component {} has feedback messages", fc);
error =
fc.getFeedbackMessages().first(FeedbackMessage.ERROR).getMessage().toString();
} else {
error = "Your input is invalid.";
}
fc.getResponse().write(
"" + error + "");
}else{
logger.debug("Form component {} is valid", fc);
}
}
}*

Any clues? I've been trying to crack this for a whole day.

-- 
Thanks & regards
James Selvakumar