Wie wärs damit? (getestet mit IE6 und Mozilla).
In Domino müsste man im html Tab von den jeweiligen Elementen die jeweilige ID eintragen.
Alles was in <script language="javaScript"> steht muss in den html-header.
Die tags div öffnend und div-schliessend als passThru html und vom Notes-Client verbergen.
Ein bischen problematischer wirds, wenn die Radio-Buttons dynamisch generiert werden sollen. Geht aber auch. Mit computedText.
<html>
<head>
<script language="javaScript">
function loadDocument() {
document.getElementById('auswahl').style.visibility = "hidden";
}
function showMySelection() {
document.getElementById('auswahl').style.visibility = "visible";
}
function commitMySelection() {
theForm = document.forms[0];
theForm.ergebnis.value=getSelectedRadioValue(theForm.auswahl);
this.value=getSelectedRadioValue(theForm.auswahl);
document.getElementById('auswahl').style.visibility = "hidden";
}
// von http://www.breakingpar.com/bkp/home.nsf/0/CA99375CC06FB52687256AFB0013E5E9
function getSelectedRadioValue(buttonGroup) {
// returns the value of the selected radio button or "" if no button is selected
var i = getSelectedRadio(buttonGroup);
if (i == -1) {
return "";
} else {
if (buttonGroup[i]) { // Make sure the button group is an array (not just one button)
return buttonGroup[i].value;
} else { // The button group is just the one button, and it is checked
return buttonGroup.value;
}
}
} // Ends the "getSelectedRadioValue" function
// http://www.breakingpar.com/bkp/home.nsf/0/CA99375CC06FB52687256AFB0013E5E9
function getSelectedRadio(buttonGroup) {
// returns the array number of the selected radio button or -1 if no button is selected
if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
for (var i=0; i<buttonGroup.length; i++) {
if (buttonGroup[i].checked) {
return i
}
}
} else {
if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
}
// if we get to this point, no radio button is selected
return -1;
} // Ends the "getSelectedRadio" function
</script>
</head>
<body onLoad="loadDocument()">
<form>
<input id="ergebnis" name="ergebnis" type="text" value="" onFocus="alert('no foolin'); blur();">
<input name="showSelection" value="showSelection" type="button" onClick="showMySelection()">
<div id="auswahl">
<input name="auswahl" type="radio" value="grün" onClick="commitMySelection();">rot</input>
<input name="auswahl" type="radio" value="gelb" onClick="commitMySelection();">gelb</input>
<input name="auswahl" type="radio" value="blau" onClick="commitMySelection();">blau</input>
</div>
</form>
</body>
</html>
hier noch klassischere Lösung mit popup:
2 Dateien:
opener:
<html>
<head>
<script language="javaScript">
function closeChild() {
if (window.childPopUp && window.childPopUp.open && !window.childPopUp.closed){
window.childPopUp.opener = null;
window.childPopUp.close();
}
}
function openPopUp() {
childPopUp = window.open("popUp.html", "Fenster1", "width=310,height=400,left=200,top=100");
}
</script>
</head>
<body onUnload="closeChild()">
<form>
<input id="ergebnis" name="ergebnis" type="text" value="" onFocus="alert('no foolin'); blur()">
<input name="showSelection" value="showSelection" type="button" onClick="openPopUp()">
</form>
Text dadrunter.
</body>
</html>
popUp:
<html>
<head>
<script language="javaScript">
function commitMySelection() {
if (window.opener && !window.opener.closed) {
parentForm = window.opener.document.forms[0]
window.opener.document.bgColor = "beige";
thisForm = document.forms[0];
parentForm.ergebnis.value=getSelectedRadioValue(thisForm.auswahl);
window.close();
} else {
alert("window opener ist geschlossen!!!");
}
}
// von http://www.breakingpar.com/bkp/home.nsf/0/CA99375CC06FB52687256AFB0013E5E9
function getSelectedRadioValue(buttonGroup) {
// returns the value of the selected radio button or "" if no button is selected
var i = getSelectedRadio(buttonGroup);
if (i == -1) {
return "";
} else {
if (buttonGroup[i]) { // Make sure the button group is an array (not just one button)
return buttonGroup[i].value;
} else { // The button group is just the one button, and it is checked
return buttonGroup.value;
}
}
} // Ends the "getSelectedRadioValue" function
// http://www.breakingpar.com/bkp/home.nsf/0/CA99375CC06FB52687256AFB0013E5E9
function getSelectedRadio(buttonGroup) {
// returns the array number of the selected radio button or -1 if no button is selected
if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
for (var i=0; i<buttonGroup.length; i++) {
if (buttonGroup[i].checked) {
return i
}
}
} else {
if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
}
// if we get to this point, no radio button is selected
return -1;
} // Ends the "getSelectedRadio" function
</script>
</head>
<body>
<form>
<div id="auswahl">
<input name="auswahl" type="radio" value="grün" onClick="commitMySelection();">rot</input>
<input name="auswahl" type="radio" value="gelb" onClick="commitMySelection();">gelb</input>
<input name="auswahl" type="radio" value="blau" onClick="commitMySelection();">blau</input>
</div>
</form>
</body>
</html>
Das komplexeste ist eigentlich die Verbindung zwischen beiden zu halten.
Checke onUnload Event im opener sowie if Abfrage in commit-Funktion von popUp.
Ich glaub das ist so sauber.
In notes würde ich popUp.html als treat content as html page implementieren und einfach den html code da rein pasten. Bei dynamischen Checkboxen mit computedText arbeiten.
Gruß Axel