facebook

JavaScript and Struts

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #257728 Reply

    pablogmuller
    Member

    Hi,
    I have a struts form with two selects. The idea is to have a some elements in one and add or remove the selected element to the other with the “>” and the “<” buttons. Is a classic assignation problem.
    I’ve been trying to do this with javascript. I found a script that works for this that recieves the select objects. So, I have to pass these objects to the function.
    If I use document.getElementsByName(‘name’); it finds the object, but when I try to get the selected elements with:

    for (var i = 0; i < CONTROL.length; i++) {
    if (CONTROL.options[i].selected == true)

    I get an error saying that CONTROL.options has no properties.
    The script I have originally used document getElementById(‘id’), but since struts’ tags don’t support the id attribute I had to change it to document.getElementsByName(‘name’);
    Does anyone know what to do here?
    I didn’t know whether to post this in this forum or in the web development one, but since it has to do with struts I posted here. Sorry if it belongs to the other one.
    Thanks.
    Pablo

    #257756 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: JavaScript and Struts

You must be logged in to post in the forum log in