How To Retrieve The Value Of A "Notes" Radio Button In A Javascript Code
In the form, place three fields, hidden from web browsers :
$$HTMLHead will be "computed for display" and will content this code as value :
"<script LANGUAGE=\"JavaScript\">
<!--"+@Newline+
" function rollOver(Tag,Src){
document.images[Tag].src = Src; return;
}
var pict1 = new Image();
var pict2 = new Image();
var pict3 = new Image();
var pict4 = new Image();
var pict5 = new Image();
pict1.src=\'/icons/picts/pict1.gif\';
pict2.src=\'/icons/picts/pict2.gif\';
pict3.src=\'/icons/picts/pict3.gif\';
pict4.src=\'/icons/picts/pict4.gif\';
pict5.src=\'/icons/picts/pict5.gif\';"+@NewLine+
"// -->
</script>"
TheList is the field where we will define the list of choices for the radio
button.
It will be computed for display too and will content, in our case, this code as
value :
"first|pict1":"second|pict2":"third|pict3":"fourth|pict4":"fifth|pict5"
If the value of the list depends on other things in the application, it's
possible to use a dblookup at this place.
Radio1 is a radio button field which is generated by a formula.
The formula will contain "TheList" as value.
Then write this code as "passthru HTML" :
<INPUT TYPE="radio" NAME="radio1" VALUE="" onClick="rollOver('picture',.src) ">
<SCRIPT>
for(var i=0; i<document.forms[0].elements.length;i++) {
var thisRadio = document.forms[0].elements[i];
if(thisRadio.value == "")
thisRadio.checked = true;
}
</SCRIPT>
<p>
<img src="/icons/picts/empty.gif" BORDER="0" NAME="picture" />
</p>
this last HTML code will allow the browser to update the choice of the radio
button.
The first Computed Text will contain this code :
_name := @Left(TheList;"|");
_alias := @Right(TheList;"|");
@Implode("<INPUT TYPE=\"radio\" NAME=\"radio1\" VALUE=\""+_alias+"\"
onClick=\"rollOver(\'picture\',"+_alias+".src) \">"+_name;"<BR>")
It will create the same form, but with the dynamic content.
The second Computed Text will only contain the name of the "Notes" radio button
: radio1
It will allow us to give to the javascript the right selected value.
And to finish, you can add an Action Button Submit with this classical code :
@Command([FileSave]); @Command([FileCloseWindow])
It will allow us to save the document and, then to retrieve the selected value
in the Notes field "radio1".