wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Selvakumar <ja...@mcruncher.com>
Subject Re: Feedback message is not available for behaviors added to nested form components
Date Thu, 04 Jul 2013 08:56:37 GMT
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 <sven@meiers.net> 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 <jpl@unknown.za.net> 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 <sven@meiers.net> 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(
>>>>>>                        "<div class=\"text-error\">" + error
+
>>>>>> "</div>");
>>>>>>            }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**>
>>>>> <users-unsubscribe@**wicket.**apache.org <http://wicket.apache.org><
>>>>> users-unsubscribe@**wicket.apache.org<users-unsubscribe@wicket.apache.org>
>>>>> >
>>>>>
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<users-unsubscribe@wicket.apache.org>
>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Thanks & regards
James Selvakumar
mCruncher

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message