--- loncom/publisher/publisher.html 2004/04/15 19:32:37 1.38 +++ loncom/publisher/publisher.html 2004/12/15 19:02:45 1.39 @@ -82,18 +82,25 @@ function getcurseed() { } function getproblemtype() { - if (parent.LONCAPAToBePublished.document.lonhomework) { - var optionelement; - var valueIndex=0; - for (var optionIndex=0; - optionIndex < parent.LONCAPAToBePublished.document.lonhomework.problemtype.options.length; - optionIndex++) - { - optionElement=parent.LONCAPAToBePublished.document.lonhomework.problemtype.options[optionIndex]; - if (optionElement.selected) { - return optionElement.value; - } - } + if (parent.LONCAPAToBePublished.document.lonhomework + && + parent.LONCAPAToBePublished.document.lonhomework.problemtype) { + if (parent.LONCAPAToBePublished.document.lonhomework.problemtype.value) { + return parent.LONCAPAToBePublished.document.lonhomework.problemtype.value; + } + if (parent.LONCAPAToBePublished.document.lonhomework.problemtype.options) { + var optionelement; + var valueIndex=0; + for (var optionIndex=0; + optionIndex < parent.LONCAPAToBePublished.document.lonhomework.problemtype.options.length; + optionIndex++) + { + optionElement=parent.LONCAPAToBePublished.document.lonhomework.problemtype.options[optionIndex]; + if (optionElement.selected) { + return optionElement.value; + } + } + } } return 0; }