You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by dh...@lexmark.com on 2001/06/07 00:09:08 UTC

Re: Problem with nested html:form


I do not believe that you are allowed to have nested forms in html (though
correct me if I'm wrong!).

Dave





"Marc Eckart" <th...@interlock.lexmark.com> on 06/06/2001 06:10:33 PM

Please respond to struts-user%jakarta.apache.org@interlock.lexmark.com

To:   struts-user%jakarta.apache.org@interlock.lexmark.com
cc:    (bcc: David Hay/Lex/Lexmark)
Subject:  Problem with nested html:form



Hi,

i have two forms nested in the following way :

<html:form action="album.do">
<html:hidden property="action" value="deletePhotoList" />
<html:hidden property="forward" value='<%= actionForward %>' />
<html:hidden property="id" value='<%= album.getAlbumId() %>' />
<logic:iterate id="photo" name="album" property="photoList">
....
....
....
        <html:form action="movePhotoUp.do">
        <html:hidden property="action" value="movePhoto"/>
        <html:hidden property="direction" value="up"/>
        <html:hidden property="position" value='<%=
""+((Photo)photo).getPosition() %>'/>
        <html:image src="images/up.bmp" alt="Bild nach oben verschieben"/>
        </html:form>
....
....
</logic:iterate>
</html:form>

If I now press the inner Button the outer action "album.do"  with the property
action "deletePhotoList" is called instead of "movePhotoUp.do".
I have mapped album.do and movePhotoUp.do to the same formclass.

Can anybody help me ?

Thanx,

Marc

Re: Problem with nested html:form

Posted by Ted Husted <hu...@apache.org>.
Struts doesn't have anything to do with it at this point; it's all up to
the client (e.g. browser).

The client eventually sends a request to an Action, and then Struts can
go to work again. 

The only option when HTML doesn't meet your needs is to move to an
applet. 

Marc Eckart wrote:
> 
> >I do not believe that you are allowed to have nested >forms in html (though
> >correct me if I'm wrong!).
> >
> >Dave
> 
> But we need something like nested forms, because we have actions for a list
> of objects and actions for a single one of these objects.
> 
> Do you have any idea how to realize it in an other way.
> 
> Marc

Re: Problem with nested html:form

Posted by John Raley <jo...@moonlight.com>.
This is definitely a challenge.  You can use a single form with multiple 
submits, each with a meaningful name.  The name will be sent with the 
request - use the name to select the appropriate action.

Marc Eckart wrote:

>
>But we need something like nested forms, because we have actions for a list
>of objects and actions for a single one of these objects.
>
>Do you have any idea how to realize it in an other way.
>
>Marc
>
>
>
>
>
>
>
>
>




Re[2]: Problem with nested html:form

Posted by Oleg V Alexeev <go...@penza.net>.
Hello Marc,

Thursday, June 07, 2001, 2:20:28 AM, you wrote:



>>I do not believe that you are allowed to have nested >forms in html (though
>>correct me if I'm wrong!).
>>
>>Dave

ME> But we need something like nested forms, because we have actions for a list
ME> of objects and actions for a single one of these objects.

ME> Do you have any idea how to realize it in an other way.

I think you can use such approach as -

<html:form name="albumForm" action="album.do">
<html:hidden name="albumForm" property="action" value="deletePhotoList" />
<html:hidden name="albumForm" property="forward" value='<%= actionForward %>' />
<html:hidden name="albumForm" property="id" value='<%= album.getAlbumId() %>' />
<logic:iterate id="photo" name="albumForm" property="photoList">
....
....
....
        <html:form name="movePhotoForm" action="movePhotoUp.do">
        <html:hidden name="movePhotoForm" property="action" value="movePhoto"/>
        <html:hidden name="movePhotoForm" property="direction" value="up"/>
        <html:hidden name="movePhotoForm" property="position" value='<%= ""+((Photo)photo).getPosition() %>'/>
        <html:image src="images/up.bmp" alt="Bild nach oben verschieben"/>
        </html:form>
....
....
</logic:iterate>
</html:form>

Insert direct references to the form object in tags and behavior of
your code will be more definitely.

-- 
Best regards,
 Oleg                            mailto:gonza@penza.net



Re: Problem with nested html:form

Posted by Marc Eckart <ul...@gmx.de>.

>I do not believe that you are allowed to have nested >forms in html (though
>correct me if I'm wrong!).
>
>Dave

But we need something like nested forms, because we have actions for a list
of objects and actions for a single one of these objects.

Do you have any idea how to realize it in an other way.

Marc