You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by GnomeKing <gn...@gmail.com> on 2005/07/23 11:21:34 UTC
multi page form, html:select multiple select and editing!
Hi guys,
I've got a problem I've been trying to get around for a while and I'm
hoping someone here can give me some pointers!
I have to use a multi page form for a particular bean, and one of the
latter pages has an html:select control which allows multiple
selections. It also has a checkbox.
The problem I have is that when I am editing a previously saved bean,
I can't figure out how to catch that the page has been submitted when
no selections had been made from the multiple selection box.
At least one item in the selection must be selected - and that is
checked in the validation - but if no entries are selected in the HTTP
request, the setItems is not invoked, and so it just thinks its using
the same Items as were selected when we started editing the bean!
(I do hope I'm making sense here...)
I had the same problem with the checkbox, but solved that one by
converting it into a single-select html:select with just two options
(enabled/disabled). I can't think of a way to do the same for this
problem.
Unfortunately I cannot rely on javascript as the webapp must be able
to support browsers which have javascript disabled.
Does anyone have any ideas?
Thanks,
Bob
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: multi page form, html:select multiple select and editing!
Posted by GnomeKing <gn...@gmail.com>.
On 24/07/05, Laurie Harper <la...@holoweb.net> wrote:
> You need to follow the same guidelines for selects as for checkboxes:
> ensure you reset the underlying form bean property each time.
>
> http://struts.apache.org/userGuide/struts-html.html#select
I knew about the reset method; but the problem was that it is a multi
page form, and the reset method is called for every page visited, but
not everything is included in each page.
I believe I have solved the issue using mapping.getPath() in the reset
method to identify which page has just been submitted, and only
resetting the html:select if the appropriate page is being submitted.
Bob
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: multi page form, html:select multiple select and editing!
Posted by Laurie Harper <la...@holoweb.net>.
You need to follow the same guidelines for selects as for checkboxes:
ensure you reset the underlying form bean property each time.
http://struts.apache.org/userGuide/struts-html.html#select
L.
GnomeKing wrote:
> Hi guys,
>
> I've got a problem I've been trying to get around for a while and I'm
> hoping someone here can give me some pointers!
>
> I have to use a multi page form for a particular bean, and one of the
> latter pages has an html:select control which allows multiple
> selections. It also has a checkbox.
>
> The problem I have is that when I am editing a previously saved bean,
> I can't figure out how to catch that the page has been submitted when
> no selections had been made from the multiple selection box.
>
> At least one item in the selection must be selected - and that is
> checked in the validation - but if no entries are selected in the HTTP
> request, the setItems is not invoked, and so it just thinks its using
> the same Items as were selected when we started editing the bean!
>
> (I do hope I'm making sense here...)
>
> I had the same problem with the checkbox, but solved that one by
> converting it into a single-select html:select with just two options
> (enabled/disabled). I can't think of a way to do the same for this
> problem.
>
> Unfortunately I cannot rely on javascript as the webapp must be able
> to support browsers which have javascript disabled.
>
> Does anyone have any ideas?
>
> Thanks,
>
> Bob
--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org