Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Passing a Form Parameter

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have two similar forms on a page. They are select boxes,
I know how to pass the options in the select box drop down as
a parameter, but what of if I want to a parameter so that
depending on which of the Select boxes I select a value from,
a parameter is passed. I have two of this forms in my code,
I can select an option from either, and then go to the next page.
But I need to pass a parameter, so that I would know which of
Select boxs I have clicked from, because that would determine
what query is run on the subsquent pages. This parameter can
be attached anywhere, ie with the sumbit buttons, or anywhere
in the form.

All I want is if I select an option from select dropdown 1, a
parameter called box1 is passed, if I select from drowdown 2 ,
a parameter box 2 is passed.

Here is my code



[ December 04, 2007: Message edited by: Ben Souther ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sege,
It looks like you're writing your pages with Struts.
Since Struts offers its own solutions to a lot of typical problems, you're probably better off asking in our Struts forum.
I'll move this thread over there for you.
-Ben
 
Sege Stephen
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben, Sorry. Yes I am using struts for my application, I posted it on the JSP forum because I thought my problem had to do with a JSP page. Anyway thanks for letting me know, knowing that will let me get better and quicker answers next time, also it would me less work for you as well.

Beside, I found the solution to my problem, I try to solve it before posting it here, but once I am getting no where, I thought it was better to as.

I solve it by adding a single line to my code

<input type="hidden" name="param_name" value="box1" />
 
machines help you to do more, but experience less. Experience this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic