File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Problem with select tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with select tag" Watch "Problem with select tag" New topic
Author

Problem with select tag

Swathi Ram
Greenhorn

Joined: Sep 18, 2007
Posts: 27
Hai,

I had a jsp in that I had a input feild for number of jobs.Depending on
that input ,that many times the below tag must be display.

<td><s:select theme="simple" name="jobList[%{#rowstatus.index}].jobType" list="positionsList" emptyOption='true'/></td>

Until here it is working fine.But I'm having a button when I click on that
it should select the value for other dropdowns same as the first dropdown .
I'm trying to do this using onclick javascript

for(var i=1;i<=noofjobs;i++){
document.getElementById("jobList[i].speciality").option[document.postBulkJobs.jobList[0].speciality.selectedIndex].selected= true;
}

But it is not working . I'm not able to get selected value to the javascript . Is this the correct way to do it.

Please help
John Simpson
Greenhorn

Joined: Sep 10, 2007
Posts: 25
Sounds like you need to ping the server first. Try using an Ajax framework instead of plain old javascript...

Just a thought
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The problem is with the following code fragment:

When you have an element name containing characters that mean something in JavaScript such as square brackets or periods, you can't use the above method to retrieve the object. You must instead use either getElementById or getElementsByName to retrieve the object.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with select tag
 
Similar Threads
Null pointer setting values to an object list
Passing parameters in XSL to JavaScript
Passing parameters in XSL to JavaScript
Ajax, Struts, and a few pesky event based issues
session management problem with iframes