• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

is nesting of struts html:form valid & how it works

 
Ranch Hand
Posts: 62
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
in my dooffice.jsp page, the user must select proper location and proper area.So i have to open an popup which lists all locations and one for all area's. for both of this i have following code in dooffice.jsp

NOTE:i have removed every lessthan and greaterthan sign from struts/html tags and also changed to onclickee instead of onclick

CODESEGMENT1 starts:-----

html:form action="addeditoffice"
input type="hidden" name="reqCode" value="p"

html:text name="officeForm" property="location" disabled="true"/
html:submit alt = "Select a location" tabindex="0" onclickee="this.form.elements['reqCode'].value='getlocation';return openpopup(this.form, '', '250', '220', event);" value="?"/

html:text name="officeForm" property="areaName"/
html:submit alt = "Select the Area" tabindex="1" onclickee="this.form.elements['reqCode'].value='getarea';return openpopup(this.form, '', '250', '220', event);" value="?"/

/html:form

CODESEGMENT1 ends:-----

above code works properly.no problem in that
After the user selects area & location, the user would fill the address,telephone number etc.
i need to store area,location,address,telephone etc in database.
so i have nested CODESEGMENT1 inside another set of html:form like below

MAINCODESEGMENT starts:----

html:form action="addeditoffice" method="post"
CODESEGMENT1.....
html:text name="officeForm" property="address1"/
html:text name="officeForm" property="phone1"/

input type="hidden" name="saveEdit" value="saveedit"
html:submit alt="edit office" property="action" value="edit" onclickee="javascript:return editoffice(document.forms[0]);"/
MAINCODESEGMENT ends----

but when i click the submit button, i cannot get the hidden variable nameed saveEdit in my Action class,instead iam getting the hidden variable reqCode .I need to decide whether to update or insert a record based on the value of hidden variable saveEdit.The javascript function editoffice() just submits the form.

what can be the reason?
How does an html:form nested inside the other work?

thanks
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't nest forms. It doesn't make any sense. And if you're doing XHTML, it won't validate.
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, I don't think it works under struts anyway and rightly so. You should never nest forms.

Struts also doesn't do pop-ups so what you can do is dump a bean on the session with the data from you "inner form" if you need to
[ December 09, 2004: Message edited by: John Smith ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic