It would be better if you used one field and called it, for example, "Location." Then, in your .cfg file define your radio field as follows:
Code:
# Radio fields. Field name => comma seperated list of radio buttons.
%db_radio_fields = (
Location => 'north,south,east,west'
);
If you want each of the options on a different line, you can go into the db.cgi script and alter sub build_radio_field. Add the bolded letters below:
Code:
sub build_radio_field {
# --------------------------------------------------------
# Builds a RADIO Button field based on information found
# in the database definition. Parameters are the column to build
# and a default value (optional).
my ($column, $value) = @_;
my (@buttons, $button, $output);
@buttons = split (/,/, $db_radio_fields{$column});
if ($#buttons == -1) {
$output = "error building radio buttons: no radio fields specified in config for field '$column'!";
}
else {
foreach $button (@buttons) {
$value =~ /^\Q$button\E$/ ?
($output .= qq|<INPUT TYPE="RADIO" NAME="$column" VALUE="$button" CHECKED> $button
<BR>\n|) :
($output .= qq|<INPUT TYPE="RADIO" NAME="$column" VALUE="$button"> $button
<BR>\n|);
}
}
return $output;
}
If you are not using the autogenerate feature, in the place where you want the radio buttons to print out in html_record_form, use
Code:
|; print &build_radio_field("Location",$rec{'Location'}); print qq|
------------------
JPD