javascript in iterator- multiple submit buttons

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • zapounidous

    javascript in iterator- multiple submit buttons


    I have a form that when the user clicks on button calls a servlet
    that performs a query on a database and displays the results on a ne
    window.
    The user selects from the new window and with the use of javascrip
    some values from
    the second window pass to the first one.

    The problem is that nomatter what button I choose the same value i
    passed to the first window.
    Javascript returns only the first row values.
    I think that onClick has the problem, but how i can make choose butto
    to retrieve only the
    values of its row?

    How can I solve this problem? Thanks

    here is my code:

    for (Iterator iter = results; iter.hasNext(); )
    { ResultBinding resb = (ResultBinding) iter.next();

    Object x = resb.get("x");
    int indexX=x.toStri ng().indexOf('# ');
    String xstring=x.toStr ing().substring (indexX+1);
    Object y = resb.get("y");
    int indexY=y.toStri ng().indexOf('# ');
    String ystring=y.toStr ing().substring (indexY+1);
    Object z = resb.get("z");
    int indexZ=z.toStri ng().indexOf('# ');
    String zstring=z.toStr ing().substring (indexZ+1);
    Object a = resb.get("a");
    int indexA=a.toStri ng().indexOf('# ');
    String astring=a.toStr ing().substring (indexA+1);
    Object b = resb.get("b");
    int indexB=b.toStri ng().indexOf('# ');
    String bstring=b.toStr ing().substring (indexB+1);


    out.println("<t r><td>ABE:</td><td><input type='text' readonl
    size='5' id='getABE' value='" +ystring+ "'></td><td>AEE:</td><td><inpu
    type='text' size='15' readonly id='getAEE' value='");
    out.println(ast ring+ "'></td><td>Temp Title:</td><td><inpu
    type='text' readonly size='25' value='" +zstring
    "'></td><td>Deposito r</td><td><input type='text' readonly size='15
    id='getDep' value='");
    out.println(bst ring+"'></td><td><input type='button
    value='Choose'" );
    out.println("on click=\"window. opener.NewDescr iptionForm.Desc ABE.value=getEl ementById('getA BE').value;wind ow.opener.NewDe scriptionForm.D escAEE.value=ge tElementById('g etAEE').value;w indow.opener.Ne wDescriptionFor m.DescDepositor .value=getEleme ntById('getDep' ).value;window. close()\";></td></tr>");

    }

    } //end i

    zapounidou
    -----------------------------------------------------------------------
    Posted via http://www.mcse.m
    -----------------------------------------------------------------------
    View this thread: http://www.forum4designers.com/message43021.htm

  • Erwin Moller

    #2
    Re: javascript in iterator- multiple submit buttons




    Hi,

    Just check the HTML you produce by this java, and you'll probably see what
    is wrong: end of lines all through you HTML.
    Your HTML looks like this:

    <input type="text" readonly id='getABE' value='
    somethinghere
    '>

    So try using print instead of println.

    Regards,
    Erwin Moller


    Comment

    Working...