PDA

View Full Version : setting values to documentment.form.field


javaspace
11-14-2002, 03:47 AM
Hello:

I have a script which populates data from a database into a table. I have given each row an unquie number. Two of the columns is datein and dateout. So my first table row has a column named as 01datein and another column as 01dateout. This goes on depending on the number of rows. If I had 20 rows the last row column name is 20datein and 20dateout.

Now the first column of each row is a radio button with the same numbering sequence. When a user selects a radio button, I have onclick function and pass the row number. In this function I want to see what the value of the datein and dateout is.

Can I use the seq. number like this: document.frm.__datein and document.frm.__dateout. Now the undersocre should be the seq.number.

Can some please help, and give me a sample code or explain how I can do this. Thanks for your help in advance.

Thanks
GG

beetle
11-14-2002, 04:21 AM
Uh, like this?

document.frm.elements[num + "datein"].value
document.frm.elements[num + "dateout"].value

Where num is the value passed to your function...

javaspace
11-15-2002, 03:18 PM
Hi Thanks for the reply.

But here is the code sample: When a user clicks on the radio button I am calling a VBSCRIPT. In that script I am trying to get the value id=88POut and value of id=88Pin. I have 88 rows. User can click on any row. So my function should be able to use a variable. Here is the fuction:

function SetHiddenField (strCount)
vpout="document.frmDoor." &CInt(trim(strCount)) &"POut.value"
end function

<tr>
<td>

<input id="88" type="radio" value="V1" name="R1" language="VBSCRIPT" onclick="SetHiddenField('88')"> </td>

<td id="88door" width="66"><font face="Arial" size="1">&nbsp;KN Bldg. 1 Y050</td>
<td id="88RsrvedAcc" width="52"><font face="Arial" size="1">&nbsp;Kent WA</td>
<td id="88RsrvedTask" width="61"><font face="Arial" size="1">&nbsp;Both</td>
<td id="88Carrier" width="53"><font face="Arial" size="1">&nbsp;</td>
<td id="88PresentAcc" width="67"><font face="Arial" size="1">&nbsp;</td>
<td id="88Inb" width="26"><font face="Arial" size="1">&nbsp;</td>
<td id="88Out" width="46"><font face="Arial" size="1">&nbsp;</td>
<td id="88POut" width="38"><font face="Arial" size="1">*</td>
<td id="88Pin" width="21"><font face="Arial" size="1">*</td>
<td id="88Tprefix" width="42"><font face="Arial" size="1">&nbsp;</td>
<td id="88Tnumber" width="57"><font face="Arial" size="1">&nbsp;</td>
<td id="88CurTask" width="65"><font face="Arial" size="1">&nbsp;</td>
<td id="88Drop" width="70"><font face="Arial" size="1">&nbsp;</td>
<td id="88CurStatus" width="68"><font face="Arial" size="1">&nbsp;</td>
<td id="88EmpWork" width="90"><font face="Arial" size="1">&nbsp;</td>
</tr>