Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

assign dropdown selected value to a java variable

 
khamhielle gabriel
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • 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
 
Saikat Roy Mahasay
Greenhorn
Posts: 10
Fedora Opera VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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
Fedora Opera VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
forgot to end this topic

its case solve

my overwhelming gratitude to you saikat.

GOD Bless you always
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic