Pop up window details to update parent details

Dear Paul,
Yes I am replacing the “Select” word with the tyre serial which they have selected. I am stuck is how to do the checking on who have the “Select” text? Must I do a for loop as I proposed earlier? Thank you.

A loop of the anchor elements would do, where you check the nodeValue for the “Select” text.

Dear Paul,
I know this loop is to get all the elements. What do you mean by anchor element and how to go about that?

var elem = document.getElementById(‘form1’).elements;
for(var i = 0; i < elem.length; i++)
{

}

If you have a reference to the form, you can use the .getElementsByTagName() method to retrieve all of the elements within the form, of a given tag name.

For example:

var links = form.getElementsByTagName(‘a’);

Dear Paul,
The problem each time I change the drop down list value the tag names also will be different so how to cater for that? My names will be not fixed and according to the layouts.

You retrieve them during the validation process of the form, so that the current state of the form is what gets processed.

Dear Paul,
Based on the link you gave I am trying to modify now. The table name is fine. But how to loop all the tr because in this case I only get one ‘tr’ right? So after the ‘tr’ I must get the ‘td’ right?

var table = document.getElementById(“tblLayoutDetails”);

var cells = table.getElementsByTagName(“tr”);

for (var i = 0; i < cells.length; i++) {
var status = cells[i].getAttribute(“data-status”);

 if ( status == "open" ) {   

    // grab the data   
 }  

}

The code from that documentation site only shows an example of how the getElementsByTagName method can be used. However, it’s not a template of the code that you need to write to solve your problem.

Dear Paul,
Any hints how to start and move or should I use the traditional way of looping through everything like this var elem = document.getElementById(‘form1’).elements;
for(var i = 0; i < elem.length; i++)?

That will only get you the form controls - like textarea, input or select - it won’t do anything about helping you to retrieve the links from within the form.

You need to gain a reference to the form, and then use that form reference to get the links by their tag name, that being “a”.

Dear Paul,
Can you help me with snippet of codes because I dont know how to further traverse to achieve the “a” value?

I am not in a situation to do that for you, but I can help you with any problems you may be facing.

Dear Paul,
Ok I can now traverse through specifically just the table and manage to get exact number of row and columns as below. Can help me how to put in the validation now?

var table = document.getElementById(“tblLayoutDetails”);
alert("Rows length : "+table.rows.length);
for(var i=1;i<table.rows.length;i++){

cells = table.rows[i].getElementsByTagName(“td”);
alert(“Cells length :”+cells.length);
for (var i = 0; i < cells.length; i++) {

}

}

I thought you just needed to loop through the links in the form?

Dear Paul,
Yes but how to retstrict it using the column number is it? Or any other method?

I don’t understand. What is there to restrict?

Dear Paul,
Because you said to get only the links I dont know how to get via your method the only way I can think of is for (var i = 0; i < cells.length; i++) { get only the specific column related to links is that correct?

[QUOTE=newtomysql;4923031Because you said to get only the links I dont know how to get via your method[/QUOTE]

Presume that the form is wrapped around the table that has the links.

Step 1. Gain a reference to the form
Step 2. Use getElementsByTagName to get all of the “a” tags that are inside of the form.

Dear Paul,
I dont get you how to get Step 2. because getElementsByTagName require the exact name right? I am stuck here dont know how to proceed with your idea?

[QUOTE=newtomysql;4923034]I dont get you how to get Step 2. because getElementsByTagName require the exact name right?[quote]

It just requires the tag name. Do you know about HTML tag names, like div, or p, or a, or img? Those are tag names.