• 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

assign dropdown selected value to a java variable

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

i have a drop down in <form name=dropdown> and i need to submit its value to the next page,
by clicking a button in another <form>
the next page is with String x= request.getParameter and i am getting null.

how can i able to resolve such.


<form name = dropdownn action="a.jsp">
<select name "select">
<option>1</option>
<option>2</option>
</select>
</form>

<form name= button action="b.jsp">

<input type ="submit">click</input> --------------------------> this button should send the selected value
</form>



the reason why the button is on the second form is for design purposes.


sorry im really not good at this.


thank you so much.

God Bless you
 
Greenhorn
Posts: 10
Opera VI Editor Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you want to submit the first form, rather than the second. The submit button in the provided code submits the second form. Hence your parameter is null.

You could try to change the submit to a button or link, and use javascript to submit the other form like or

All the best.
 
khamhielle gabriel
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you so much for your reply roy

and yuo are correct.

i want to pass the first' forms value rather than the second one.


in relation to your suggestion can you hand me some example on how could i be able to use document.dropdown.submit() ?

again sorry for not knowing it.

thanks
 
Saikat Roy Mahasay
Greenhorn
Posts: 10
Opera VI Editor Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Gabriel

The code you posted is not complete, and I could not get the first form from it. Here's a sugestion though :-

1. Add a bit of javascript in your code, like this:



2. Call this in the onClick of your button, by the way, I think you should make it a button instead of submit. I am not sure of this, but it seems counter-intuitive(and unlikely) that 2 forms can be submit concurrently.



Hope this helps.
Regards
Saikat
 
khamhielle gabriel
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
forgot to end this topic

its case solve

my overwhelming gratitude to you saikat.

GOD Bless you always
 
I guess I've been abducted by space aliens. So unprofessional. They tried to probe me with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic