• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Problem with select tag

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like you need to ping the server first. Try using an Ajax framework instead of plain old javascript...

Just a thought
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic