Re: CheckGroup form submission bug

2007-09-21 Thread Kent Tong


Nick Busey wrote:
 
 So I've got what appears to be a very strange bug. I have a CheckGroup
 with a ListView of Checks among other things. Everything seems to work
 fine if you render the form and submit it without any errors the first
 time. However, if you hit any errors (like not selecting any Checks), and
 are bounced back to the form with an error rendered, if you select a Check
 and re-submit it, it dies with the following error:
 

I can't reproduce this behavior. My code seems to work fine. Try it.




-- 
View this message in context: 
http://www.nabble.com/CheckGroup-form-submission-bug-tf4489122.html#a12832939
Sent from the Wicket - User mailing list archive at Nabble.com.


CheckGroup form submission bug

2007-09-20 Thread Nick Busey

So I've got what appears to be a very strange bug. I have a CheckGroup with a
ListView of Checks among other things. Everything seems to work fine if you
render the form and submit it without any errors the first time. However, if
you hit any errors (like not selecting any Checks), and are bounced back to
the form with an error rendered, if you select a Check and re-submit it, it
dies with the following error:

WicketMessage: submitted http post value [check22] for CheckGroup component
[14:slurpFormResults:resultPanel:group] contains an illegal relative path
element [check22] which does not point to a Check component. Due to this the
CheckGroup component cannot resolve the selected Check component pointed to
by the illegal value. A possible reason is that componment hierarchy changed
between rendering and form submission.

Root cause:

org.apache.wicket.WicketRuntimeException: submitted http post value
[check22] for CheckGroup component [14:slurpFormResults:resultPanel:group]
contains an illegal relative path element [check22] which does not point to
a Check component. Due to this the CheckGroup component cannot resolve the
selected Check component pointed to by the illegal value. A possible reason
is that componment hierarchy changed between rendering and form submission.
at
org.apache.wicket.markup.html.form.CheckGroup.convertValue(CheckGroup.java:141)
etc..

Here's the code:

final ListView contactsList = new ListView(contactRepeater, 
new
PropertyModel(this,
contacts))
{
private static final long serialVersionUID = 1L;

@Override
protected void populateItem(ListItem item)
{
ExternalContact p = (ExternalContact) 
item.getModelObject();
Check check = new Check(selected, new 
Model(item.getIndex()));
String mail = p.getEMailAddress();
if (mail == null)
{
p.setEMailAddress(p.getUserName());
}
check.add(new SimpleAttributeModifier(id, 
p.getEMailAddress()));
// Create and style image
StaticImage image = new StaticImage(pic, new 
Model(p.getImageURL()));
String pic = p.getImageURL();
Label picBlock = new Label(picBlock, new 
Model());
picBlock.add(new 
SimpleAttributeModifier(class, noPictureInactive));
item.add(picBlock);
item.add(image);
String emailLabel = new String();
emailLabel = p.getEMailAddress();

item.add(new Label(emailLabel, new 
Model(emailLabel)));
item.add(check);
item.add(new SimpleAttributeModifier(for, 
p.getEMailAddress()));
item.add(new SimpleAttributeModifier(class, 
pictureContainer  +
p.getType().toString()));
}
};
group = new CheckGroup(group, new ArrayList());
group.add(contactsList);
group.add(new CheckGroupSelector(groupSelect));
group.setOutputMarkupId(true);

Any help or ideas would be greatly appreciated. Thanks!
-- 
View this message in context: 
http://www.nabble.com/CheckGroup-form-submission-bug-tf4489122.html#a12802495
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: CheckGroup form submission bug

2007-09-20 Thread Igor Vaynberg
if your listview is in a form you have to call listview.setreuseitems(true);

-igor


On 9/20/07, Nick Busey [EMAIL PROTECTED] wrote:


 So I've got what appears to be a very strange bug. I have a CheckGroup
 with a
 ListView of Checks among other things. Everything seems to work fine if
 you
 render the form and submit it without any errors the first time. However,
 if
 you hit any errors (like not selecting any Checks), and are bounced back
 to
 the form with an error rendered, if you select a Check and re-submit it,
 it
 dies with the following error:

 WicketMessage: submitted http post value [check22] for CheckGroup
 component
 [14:slurpFormResults:resultPanel:group] contains an illegal relative path
 element [check22] which does not point to a Check component. Due to this
 the
 CheckGroup component cannot resolve the selected Check component pointed
 to
 by the illegal value. A possible reason is that componment hierarchy
 changed
 between rendering and form submission.

 Root cause:

 org.apache.wicket.WicketRuntimeException: submitted http post value
 [check22] for CheckGroup component [14:slurpFormResults:resultPanel:group]
 contains an illegal relative path element [check22] which does not point
 to
 a Check component. Due to this the CheckGroup component cannot resolve the
 selected Check component pointed to by the illegal value. A possible
 reason
 is that componment hierarchy changed between rendering and form
 submission.
 at
 org.apache.wicket.markup.html.form.CheckGroup.convertValue(CheckGroup.java
 :141)
 etc..

 Here's the code:

 final ListView contactsList = new
 ListView(contactRepeater, new
 PropertyModel(this,
 contacts))
 {
 private static final long serialVersionUID = 1L;

 @Override
 protected void populateItem(ListItem item)
 {
 ExternalContact p = (ExternalContact)
 item.getModelObject();
 Check check = new Check(selected, new
 Model(item.getIndex()));
 String mail = p.getEMailAddress();
 if (mail == null)
 {
 p.setEMailAddress(p.getUserName
 ());
 }
 check.add(new
 SimpleAttributeModifier(id, p.getEMailAddress()));
 // Create and style image
 StaticImage image = new StaticImage(pic,
 new Model(p.getImageURL()));
 String pic = p.getImageURL();
 Label picBlock = new Label(picBlock, new
 Model());
 picBlock.add(new
 SimpleAttributeModifier(class, noPictureInactive));
 item.add(picBlock);
 item.add(image);
 String emailLabel = new String();
 emailLabel = p.getEMailAddress();

 item.add(new Label(emailLabel, new
 Model(emailLabel)));
 item.add(check);
 item.add(new
 SimpleAttributeModifier(for, p.getEMailAddress()));
 item.add(new
 SimpleAttributeModifier(class, pictureContainer  +
 p.getType().toString()));
 }
 };
 group = new CheckGroup(group, new ArrayList());
 group.add(contactsList);
 group.add(new CheckGroupSelector(groupSelect));
 group.setOutputMarkupId(true);

 Any help or ideas would be greatly appreciated. Thanks!
 --
 View this message in context:
 http://www.nabble.com/CheckGroup-form-submission-bug-tf4489122.html#a12802495
 Sent from the Wicket - User mailing list archive at Nabble.com.


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




Re: CheckGroup form submission bug

2007-09-20 Thread Jan Kriesten

hi nick,

 Thanks, this does fix this particular bug, but now I can't add items into the
 ListView. I'm trying to add items via AJAX, and with reuseItems turned on,
 it no longer adds the new items to the list like it should be.

listview isn't designed like that, so this wont work with ajax. i stumbled over
this a couple of month ago when designing an app to insert items with ajax into
a listview, too.

you have to create your own model to handel listviews, so for one you can reuse
items but also do dynamic inserts which the listview will be aware of. you might
take a look at the code to understand why it's not working.

i solved this by creating a so-called 'FlexListView' with a 'FlexItemModel'
containing 'FlexItems'. ;-) This View isn't using a List's index to reference
the items but looks them up in a Map, so insert's don't effect the lookup to
reuse Items.

Hope you get an idea.

Best regards, --- jan.


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



Re: CheckGroup form submission bug

2007-09-20 Thread Nick Busey

Thanks a lot for the help! I don't suppose you could post some of these Flex
objects?


Jan Kriesten wrote:
 
 
 hi nick,
 
 Thanks, this does fix this particular bug, but now I can't add items into
 the
 ListView. I'm trying to add items via AJAX, and with reuseItems turned
 on,
 it no longer adds the new items to the list like it should be.
 
 listview isn't designed like that, so this wont work with ajax. i stumbled
 over
 this a couple of month ago when designing an app to insert items with ajax
 into
 a listview, too.
 
 you have to create your own model to handel listviews, so for one you can
 reuse
 items but also do dynamic inserts which the listview will be aware of. you
 might
 take a look at the code to understand why it's not working.
 
 i solved this by creating a so-called 'FlexListView' with a
 'FlexItemModel'
 containing 'FlexItems'. ;-) This View isn't using a List's index to
 reference
 the items but looks them up in a Map, so insert's don't effect the lookup
 to
 reuse Items.
 
 Hope you get an idea.
 
 Best regards, --- jan.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/CheckGroup-form-submission-bug-tf4489122.html#a12803885
Sent from the Wicket - User mailing list archive at Nabble.com.


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