• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

getting selected values from a list

 
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have a list <html:select> in a tabbed pane. I have yet another list, which is empty to begin with. I give the user to move elements from the first list to the second.

I use javascript to move the elements. I have the code like this:



I get the following exception: document.form.tabbedPane1.mappedDates is null or not an object. Please help!
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think your syntax is wrong. It should be:

document.formName.elementName....

or

document.forms["formName].elementName

Eric
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would realy like to see the HTML for the form. But for now my guess would be (assuming name of your form is "form"):

instead of
document.form.tabbedPanel1.mapDates.lstDateRange.disabled
you should use
document.form.lstDateRange.disabled

instead of
document.form.mapDates.lstDateRange
use
document.form.lstDateRange

instead of
document.form.lstDateRange.length
use
document.form.lstDateRange.options.length

instead of
document.form.tabbedPanel1.mapDates.lstDateRange.options[i].selected
use
document.form.lstDateRange.options[i].selected

I probably missed something , but try that.
 
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by JayaSiji Gopal:

I get the following exception: document.form.tabbedPane1.mappedDates is null or not an object.



What is "tabbedPane1"?

if the name of the form element is "mappedDates", the appropriate referencing syntax would be:

 
JayaSiji Gopal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried document.form.lstDateRange...however, it gives the same error.

code for the tabbed pane is


the javascript is in a jsp and the above code is in a jspf.

the code for the jsp is as follows:

 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can not embed a form inside of a table!

You are not using the correct form name in your script?

Eric
 
JayaSiji Gopal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried to put the <h:form> outside the table. This does not help. I have removed the name of the form. However, no clue...plz help. This code works fine when i put it in plain JSP
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you specifying the correct form name? Are you specifying the correct element name.

Do yourself a favor and do a view source on the generated code. Look at what is there and paste it here between code tags.

Eric
 
JayaSiji Gopal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am posting the view source code tht is generated:

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic