Win a copy of Terraform in Action this week in the Cloud forum!

Pavan Keely

Ranch Hand
+ Follow
since Jun 30, 2006
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Pavan Keely

In my above reply, modal=yes related to
Thanks Bear...Forgot to mention that.

But you can try using modal=yes as the third argument for other browsers. But the way you handle the return value will change. I have never tried that.

Or you may use something similar to . Never tried though.

All the best.

You may use Modal Dialog boxes for your requirement.
Those are called anonymous functions. You can assign these function references to any variable. like,

var myFunc = function() {
//code here

and call that function like, myFunc();

If you don;t assign this function reference to any varible/object property, it's not much of use.
You are updating the winRef everytime you open the window. Try to use an array of window references.

var winReferences = new Array();

so, when you open a window, winReferences[ winReferences.length ] =

and change your checkPoppedWindows function to something like,

Forgot to mention what was the change in my code. I used escaped double quotes for the onclick attribute value.

Problem seems to be with how you defining the html content in JavaScript.

Try changing that. I haven't gone through your code completely but if it doesn;t solve the problem, I'll look further.

Seems like you have basic misunderstanding about Ajax. You are making synchronous calls, not "A"synchronous calls.

Second thing I want to say is, there is no need for callbacks if you are using synchronous calls. You unnecessarily complicated the code by having those callbacks for synchronous requests.

function valCheck(url)
//url is servlet that inturn query a database a returns a value
request = createRequestObject();
request.onreadystatechange = onResponse;"POST", url, false);

if( request.status == 200 ) {
var str = request.responseText;
// do whatever you are doing in callback handler.
else {
//write error handling code here.

If you really mean to use asynchronous calls, then change your submit button to normal button and onclick process the asynchronus call and submit form once you get confirmation from server.


N Chaurasia,

I don't think you can clone without the value. But anyways, I can think of one alternative for this. Before cloning the table row, set the value of the text field to empty then clone it and reset the value back. The pseudo code may look like this,

I think the prefered way, which will not deviate rules, is to use DOM methods or table methods to create rows.
To add one more point to my last reply, according to the standards, there should not be multiple elements with the same ID. This is quite against the rules.

Here is the sample HTML I experimented with.

Let me remind you one more time, this is IE only solution.

This is a security restriction on Modal Dialog boxes. Because the main page is accessed using "http" or "file" protocol, where as the modal dialog will have "javascript" pseudo protocol. So, if the protocols are different then they can not communicate. It's the same rule for domains. If dialog box html source is not from the same domain as main page then access then they will not communicate. I think that's the very reason why the return value is always undefined and when you try to access using HTML from the external HTML page, you are able to get the return value.

Hope you know that window.showModalDialog is not supported by Mozilla Firefox or Mozilla based browsers in general.

I am not sure what you are trying to ask. Your first question was about accessing labels and your second question was about cloning table rows. So, I assume you have labels in table rows that you are trying to clone.

When you clone the nodes the same IDs will be given to the labels as the first row's labels. So, whenever you try to access the label with the document.getElementById(...), the first element will be returned matching that id. That means the first label in the first row. So, to access the second label and so on after cloning, you have to change the Ids of those elements (in this case, labels and input fields ). There is a non-standard way that works only in IE ( with document.all ) but I would not recommend that in this case.

Hope it's clear now. If this was not answer for your question, please elaborate.
Check whether the value is assigned to text field properly.

You mean to say that text field value is not being sent to server on form submit ?