Commit cfef42e6 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Minor fix for boolean values, which are not submitted when not checked.

Also a little repourl cleanup.
parent 635c4f14
......@@ -473,17 +473,18 @@ function Do_BindParameters()
# If this is a repo-based profile, look in the form for the script
# and the paramdefs.
#
if (isset($formfields["script"]) && $formfields["script"] != "" &&
if ($profile->repourl() &&
isset($formfields["script"]) && $formfields["script"] != "" &&
isset($formfields["paramdefs"]) && $formfields["paramdefs"] != "") {
$script = $formfields["script"];
$paramdefs = $formfields["paramdefs"];
unset($formfields["script"]);
unset($formfields["paramdefs"]);
}
else {
$script = $profile->script();
$paramdefs = $profile->paramdefs();
}
unset($formfields["script"]);
unset($formfields["paramdefs"]);
if (Do_CheckForm($formfields, $paramdefs, $rval)) {
# Special return value for JS code.
......@@ -570,12 +571,18 @@ function Do_CheckForm($formfields, $paramdefs, &$rval)
$fields = json_decode($paramdefs);
while (list ($name, $def) = each ($fields)) {
if (array_key_exists($name, $formfields)) {
$val = $formfields[$name];
$type = $def->type;
$defval = $def->defaultValue;
$options = $def->legalValues;
# Watch for checkboxes that are not submitted when not checked.
if ($type == "boolean" &&
!array_key_exists($name, $formfields)) {
$formfields[$name] = $defval;
}
if (array_key_exists($name, $formfields)) {
$val = $formfields[$name];
if ($type == "pubkey") {
if (GenGenilibKey()) {
$errors[$name] = "Could not create key pair";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment