File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting selected values from a list

 
JayaSiji Gopal
Ranch Hand
Posts: 303
  • 0
  • Mark post as helpful
  • send pies
  • 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!
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think your syntax is wrong. It should be:

document.formName.elementName....

or

document.forms["formName].elementName

Eric
 
Yuriy Fuksenko
Ranch Hand
Posts: 413
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am posting the view source code tht is generated:

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic