• 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

Problem on value passing

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the help!
reply
    Bookmark Topic Watch Topic
  • New Topic