--- loncom/interface/lonpickresource.pm	2011/05/04 01:49:08	1.1
+++ loncom/interface/lonpickresource.pm	2011/05/21 01:02:27	1.2
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Pick resource or folder in the course
 #
-# $Id: lonpickresource.pm,v 1.1 2011/05/04 01:49:08 www Exp $
+# $Id: lonpickresource.pm,v 1.2 2011/05/21 01:02:27 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -52,15 +52,36 @@ sub handler {
                                              {'no_nav_bar' => 1}));
 
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['form','reslink']);
-    my $form='opener.document.'.$env{'form.form'};
+    my $form='opener.document.forms.'.$env{'form.form'};
     my $reslink=$env{'form.reslink'};
 
     $r->print('<form name="pickresource" action="/adm/pickresource">');
     $r->print(&Apache::lonstathelpers::problem_selector('.',undef,1,1,'resource'));
+    $r->print(<<ENDGETVALUE);
+<script type="text/javascript">
+function getCheckedValue(radioObj) {
+	if(!radioObj)
+		return "";
+	var radioLength = radioObj.length;
+	if(radioLength == undefined)
+		if(radioObj.checked)
+			return radioObj.value;
+		else
+			return "";
+	for(var i = 0; i < radioLength; i++) {
+		if(radioObj[i].checked) {
+			return radioObj[i].value;
+		}
+	}
+	return "";
+}
+</script>
+ENDGETVALUE
     $r->print('<input type="button" value="'.&mt('Pick').
-      '" onClick="if (this.form.resourcesymb.value!=null) { '.
-                    $form.'.resourcesymb.value=this.form.resourcesymb.value;'.
-                    $form.".cmd.value='".$reslink."';} window.close();".'" />');
+      '" onClick="val=getCheckedValue(this.form.resourcesymb);if (val) { '.
+                    $form.'.resourcesymb.value=val;'.
+                    $form.".cmd.value='".$reslink."';".
+                    $form.".submit();} window.close();".'" />');
     $r->print('</form>');
     $r->print(&Apache::loncommon::end_page());
     return OK;