• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Submitting Input fields in struts

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have qustion on submitting the input fields to the form in Struts.

if we have a checkbox,a textbox and a submit button. and if we need to send the values typed in the textbox when the submit button is clicked, we normally place these input fields within html:form tags

example:

<html:form action="something.do">
<input type="text" name="txtbox" value=""/>
<html:submit styleId="btnSubmit>Submit</html:submit>
</html:form>

Is there a way in which we don't place them within html:form and still submit the text box value when the button is clicked?


I am aksing this question because, my jsp page does different things for different kind of buttons, but for position sakes they should be aligned together, but because of html:form tag, i am not able to place them in the positions i need
 
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this is not a struts limitation/issue, but an HTML restriction. form elements must be encapsulated INSIDE the form tag to be submitted with the form.

one (insane) way to do this is use javascript. put your input field into a secondary form all by itself. put a hidden field in your primary form. onsubmit() of your primary form use javascript to grab the value from the secondary form and set the primary form's hidden field's value to that value.
 
I'm doing laundry! Look how clean this tiny ad is:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic