Hi,I have an issue with a peice of javascript I wrote to retrieve a documents unique ID based on the selected document and open it in edit mode on a web browser. The view property to allow selection of documents on the web is enabled.
this code is in an action;
function checkbox_checker()
{
// set var checkbox_choices to zero
var checkbox_choices = 0;
// Loop from zero to the one minus the number of checkbox button selections
for (counter = 0; counter < document.forms(0).$$SelectDoc.length; counter++)
{
// If a checkbox has been selected it will return true
// (If not it will return false)
if (document.forms[0].$$SelectDoc[counter].checked)
{ checkbox_choices = checkbox_choices + 1; }
}
if (checkbox_choices > 1 )
{
// If there were more than three selections made display an alert box
msg="You can only edit one document at a time. "
msg=msg + “You have made " + checkbox_choices + " selections.\n”
msg=msg + “Please remove " + (checkbox_choices-1) + " selection(s).”
alert(msg)
return (false);
}
if (checkbox_choices <= 1 )
{
// If there were less then selections made display an alert box
//alert(document.forms[0].$$SelectDoc.value)
window.location=“/Trocaire%20Databases/M&E.nsf/0/”+document.forms[0].$$SelectDoc.value+“?EditDocument”
return (true);
}
// If three were selected then display an alert box stating input was OK
for (i=0; i<document.forms[0].$$SelectDoc.length; i++){
if (document.forms[0].$$SelectDoc[i].checked==true)
window.location=“/Trocaire%20Databases/M&E.nsf/0/”+document.forms[0].$$SelectDoc[i].value+“?EditDocument”
}
return (true);
}
checkbox_checker()
from debuging this it seems the the document.forms[0].$$SelectDoc[i].value is undefined, but I cant understand as it worked initially.No javascript error is given it just goes ahead tries to open the page “/Trocaire%20Databases/M&E.nsf/0/undefined?EditDocument”
any ideas, I am stumped at the moment as if I enter Edit mode while in the document it it does this fine.
Thanks,
David.