On 10-Apr-09, at 12:58 PM, Martin Makundi wrote:
Are you trying to handle state on client side? While that is possible,
it is not the purpose of Wicket. Would you consider managing he state
on server side?
It's an existing javascript widget I wrote so I was looking for a
quick port to Wicket. However there is no reason there couldn't be two
versions, the Ajax version could redraw everything serverside upon
addition/deletion of items.
So if it's possible for me to (easily) map those two sets of hidden
inputs to my model upon form submit I'd really like to know how.
Thanks,
Craig.
**
Martin
2009/4/10 Craig Tataryn <crai...@tataryn.net>:
I have a component I'm designing where it displays a list of items
to the
user, so the setup for the component on the page might look like
this:
add(new MultiTextInput<Collection<String>>("tags", new
ArrayList<String>() {
{
add("apple");
add("banana");
}
}));
The widget will render two sets of hidden inputs, one for the
original/additional items (name="tags") which were entered and one
for
deleted items (name="removed_tags").
For instance:
<input type="hidden" name="tags" value="apple"/>
<input type="hidden" name="tags" value="peach"/>
<input type="hidden" name="tags" value="grape"/>
<input type="hidden" name="removed_tags" value="banana"/>
The above would result from me keeping apple and adding peach,
grape, and
removing banana.
I'm a bit stuck on how I should get my component to put these
values back
into it's model? Obviously in behind the scenes I'm going to have
to do
some stuff in the MultiTextInput ctor to have the incoming
Collection added
to a composite model that contains both the original/added items
and the
removed items.
I'm just not sure where I broker the form submittal so that I have
a chance
to move the "tags" and "removed_tags" into the proper place in the
model for
my component. When the user calls getModelObject() on my component
they'll
get an object back where they can query model.getItems() and
model.getRemovedItems().
As always, any help greatly appreciated!
Craig.
--
Craig Tataryn
site: http://www.basementcoders.com/
podcast:http://feeds.feedburner.com/TheBasementCoders
irc: ThaDon on freenode #basementcoders, ##wicket, #papernapkin
twitter: craiger
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org