• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem on value passing  RSS feed

 
Amy Howard
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone tell me why the following code retuens server value 'document.forms[browseForm].elements[server].value' rather than the selected item value such as "Server1"?
<A href="test/DownloadDisclaimer.jsp?server=document.forms[browseForm].elements[server].value">
Thanks for your help in advance!
 
Ben Fox
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Amy,
its because you've written the value of the variable server as a string.
<A href="test/DownloadDisclaimer.jsp?server=document.forms[browseForm].elements[server].value">
the compiler sees anything after the '=' as the value of the variable and if its a string type then it'll pass it as a string. You could equally put '=dog' or '=gravy' and it'll be just as valid.
i think the syntax would be <A href="test/DownloadDisclaimer.jsp?server="+document.forms[browseForm].elements[server].value+""> or something along those lines.
hope that helps!
Ben
 
Amy Howard
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help. I tried to get the selected value from the listbox server, but the following code can't get the server listbox selected value. Do you know how to fix this problem?
<A href="/FLVTest1/controller/DownloadDisclaimer?server=" + document.browseForm.server.options[document.browseForm.server.selectedIndex].value + "" >
[ March 14, 2003: Message edited by: Amy Howard ]
 
Geeta Ramasami
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The syntax seems to be correct.Ensure that u have values in the value attribute of the options tag.If u r trying to retrieve the text then use .text instead of .value.Are u trying to select multiple values from the listbox?
Cheers
Geeta
 
Amy Howard
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help!
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!