473,322 Members | 1,241 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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.toString().indexOf('#');
String xstring=x.toString().substring(indexX+1);
Object y = resb.get("y");
int indexY=y.toString().indexOf('#');
String ystring=y.toString().substring(indexY+1);
Object z = resb.get("z");
int indexZ=z.toString().indexOf('#');
String zstring=z.toString().substring(indexZ+1);
Object a = resb.get("a");
int indexA=a.toString().indexOf('#');
String astring=a.toString().substring(indexA+1);
Object b = resb.get("b");
int indexB=b.toString().indexOf('#');
String bstring=b.toString().substring(indexB+1);
out.println("<tr><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(astring+ "'></td><td>Temp Title:</td><td><inpu
type='text' readonly size='25' value='" +zstring
"'></td><td>Depositor</td><td><input type='text' readonly size='15
id='getDep' value='");
out.println(bstring+"'></td><td><input type='button
value='Choose'");
out.println("onclick=\"window.opener.NewDescriptio nForm.DescABE.value=getElementById('getABE').value ;window.opener.NewDescriptionForm.DescAEE.value=ge tElementById('getAEE').value;window.opener.NewDesc riptionForm.DescDepositor.value=getElementById('ge tDep').value;window.close()\";></td></tr>");

}

} //end i

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

Jul 20 '05 #1
1 1688

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
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

38
by: Grant Edwards | last post by:
In an interview at http://acmqueue.com/modules.php?name=Content&pa=showpage&pid=273 Alan Kay said something I really liked, and I think it applies equally well to Python as well as the languages...
26
by: Michael Klatt | last post by:
I am trying to write an iterator for a std::set that allows the iterator target to be modified. Here is some relvant code: template <class Set> // Set is an instance of std::set<> class...
0
by: nick | last post by:
Hi, I need to manage a "layered" collection of objects, where each layer grows independently, e.g, o--+--+--+--+--+ 1st layer | o 2nd layer (empty) | o--+--+--+ 3rd...
3
by: kiki | last post by:
Hello, I have the following code which works fine in IE, but can't get it to work in Firefox. (the idea is to get DB data without postback).. I would apreciate any ideas you might have on this.. ...
14
by: shawnk | last post by:
I searched the net to see if other developers have been looking for a writable iterator in C#. I found much discussion and thus this post. Currently (C# 2) you can not pass ref and out arguments...
0
by: mailforpr | last post by:
Hi. Let me introduce an iterator to you, the so-called "Abstract Iterator" I developed the other day. I actually have no idea if there's another "Abstract Iterator" out there, as I have never...
21
by: T.A. | last post by:
I understand why it is not safe to inherit from STL containers, but I have found (in SGI STL documentation) that for example bidirectional_iterator class can be used to create your own iterator...
16
by: mailforpr | last post by:
How do I do that? The thing is, the only information I have about the iterator is the iterator itself. No container it is belonging to or anything. Like template<Iteratorvoid...
27
by: Steven D'Aprano | last post by:
I thought that an iterator was any object that follows the iterator protocol, that is, it has a next() method and an __iter__() method. But I'm having problems writing a class that acts as an...
4
by: mkborregaard | last post by:
Hi, I have the weirdest problem, and I can not see what is going wrong. I have made a 2d container class, and am implementing an iterator for that class. However, the ++ operator is behaving very...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.