aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes getting selected values from a list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "getting selected values from a list " Watch "getting selected values from a list " New topic
Author

getting selected values from a list

JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
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!


SCJP 1.4, SCWCD 1.4<br /> <br />Thanks in advance!<br />Jayashree.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I think your syntax is wrong. It should be:

document.formName.elementName....

or

document.forms["formName].elementName

Eric
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
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

Joined: Jan 10, 2002
Posts: 60996
    
  65

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:



[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Sep 27, 2004
Posts: 303
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Sep 27, 2004
Posts: 303
I am posting the view source code tht is generated:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting selected values from a list