Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

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


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

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 just had the craziest dream. This tiny ad was in it.
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic