• 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 in javascript

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

i have a input hidden type in my jsp,which is dynamic.Now i want to getthe value for this in javascript.But what happends is,
<input type="hidden" name="<%=ddd%>" value="<%=(String)hmapasasasd.get(qqqq)%>">
now in javascript i got two values from two select option(html)
i.e var f1=document.formname.selectname.value;
var f2=document.formname.selectname.value;
var f3=f1+"-"+f2;(which my required name to get the value)
but when i try to get the required value using f3.Its not working.
i.e,var f4=document.formname.f3.value
please try to get me a solution soon. Its really urgent.
thanking you,
Ajith
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Urgent is not a good word to use on forums.

What is the error. You never mentioned what the error message was. What I do not understand is f3 is a variable so why are you referencing it as a form element?

Eric
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ajith,

I think f1, f2 values are selected values of two "select" options. To get the selected option of "select", use the following.

var f1 = document.formname.selectname.options[ document.formname.selectname.selectedIndex ].value;

var f2 = document.formname.selectname.options[ document.formname.selectname.selectedIndex ].value;

Pavan Keely
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic