Hello,
I'm new to JavaScript, and am have written the following function, which is run at the onClick event of a checkbox, and will populate Textfield1 with the contents of Textfield (the purpose is to allow a user to complete a single comments text box and then apply that comment to multiple text boxes to save typing):
I have successfully extended the function to add the value of "textfield" to multiple named text boxes.
The problem is, I want to implement the function on a page which returns multiple rows from a database (using repeat region), where I have a comment text box for each row. Each field in a row is distinguised by a unique record ID appended to its name, e.g. <input type="text" name="comments<%= intRecID %>">. This means I can no longer just refer to the specific name of the field to update it within the function, as I don't know what the value of intRecID will be. Can anyone suggest how I might adapt the function to be able to refer to these field names?
Many thanks,
-James
I'm new to JavaScript, and am have written the following function, which is run at the onClick event of a checkbox, and will populate Textfield1 with the contents of Textfield (the purpose is to allow a user to complete a single comments text box and then apply that comment to multiple text boxes to save typing):
Code:
function PopulateTextBoxes()
{
if (document.form1.checkbox.checked)
{
document.form1.checkbox.value="true"
document.form1.textfield1.value = document.form1.textfield.value
}
else
{
document.form1.checkbox.value="false"
document.form1.textfield1.value = ""
}
}
I have successfully extended the function to add the value of "textfield" to multiple named text boxes.
The problem is, I want to implement the function on a page which returns multiple rows from a database (using repeat region), where I have a comment text box for each row. Each field in a row is distinguised by a unique record ID appended to its name, e.g. <input type="text" name="comments<%= intRecID %>">. This means I can no longer just refer to the specific name of the field to update it within the function, as I don't know what the value of intRecID will be. Can anyone suggest how I might adapt the function to be able to refer to these field names?
Many thanks,
-James