L
LRW
I have no idea if this is more a PHP question or Javascript question,
because my problem hinges equally on both.
I have a PHP script that queries a database and creates a list of rows
for each item, each with their own checkbox one can select to do stuff
later. The PHP script this form posts to creates an array of all the
selected checkboxes and does stuff.
But, on the form, I want to be able to have the checkboxes auto-check
when someone changes the value of a textfield on that row.
With some stuff cut out, here's what I have on the form:
<!-- Begin
function NotEmpty() {
if (document.f.trackno$oim.value!=\"\") {
document.f.remship.checked = true ;
}
}
// End -->
<form name=\"f\" id=\"f\" method=\"post\"
action=\"trackpareportproc.bkk\">
<input name=\"remship[]\" type=\"checkbox\" value=\"$oim\"
class=\"remship\">
<input type=\"text\" name=\"trackno$oim\" size=\"40\"
onBlur=\"NotEmpty();\">
Obviously I think the problem rests in how do I get the JavaScript to
know which checkbox to check. I can't make the NAME for each checkbox
unique otherwise that would mess up the array that's created later
based on which checkboxes are selected.
Thanks for any suggestions!
Liam
because my problem hinges equally on both.
I have a PHP script that queries a database and creates a list of rows
for each item, each with their own checkbox one can select to do stuff
later. The PHP script this form posts to creates an array of all the
selected checkboxes and does stuff.
But, on the form, I want to be able to have the checkboxes auto-check
when someone changes the value of a textfield on that row.
With some stuff cut out, here's what I have on the form:
<!-- Begin
function NotEmpty() {
if (document.f.trackno$oim.value!=\"\") {
document.f.remship.checked = true ;
}
}
// End -->
<form name=\"f\" id=\"f\" method=\"post\"
action=\"trackpareportproc.bkk\">
<input name=\"remship[]\" type=\"checkbox\" value=\"$oim\"
class=\"remship\">
<input type=\"text\" name=\"trackno$oim\" size=\"40\"
onBlur=\"NotEmpty();\">
Obviously I think the problem rests in how do I get the JavaScript to
know which checkbox to check. I can't make the NAME for each checkbox
unique otherwise that would mess up the array that's created later
based on which checkboxes are selected.
Thanks for any suggestions!
Liam