Skip to content

Commit

Permalink
experiments page edits to support #2471
Browse files Browse the repository at this point in the history
  • Loading branch information
scottjehl authored Jan 12, 2023
1 parent bc162ef commit 4462d50
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions www/experiments.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,13 @@ function observationHTML($parts)
} elseif ($exp->expvar && !$exp->expval && $textinput) {
if ($experimentEnabled) {
$placeholderEncodedVal = htmlentities('<script src="https://example.com/test.js"></script>');
$textinputvalue = $exp->textinputvalue ? $exp->textinputvalue : "";
$fullscreenfocus = $exp->fullscreenfocus ? "true" : "false";
$out .= <<<EOT
</div>
<div class="experiment_description_go experiment_description_go-multi">
<label class="experiment_pair_check"><input type="checkbox" name="recipes[]" value="{$expNum}-{$exp->expvar}">Run this Experiment with:</label>
<label class="experiment_pair_value"><span>Value: </span><textarea name="{$expNum}-{$exp->expvar}[]" placeholder="{$placeholderEncodedVal}"></textarea></label>
<label class="experiment_pair_value"><span>Value: </span><textarea id="experiment-{$exp->id}-textarea" data-fullscreenfocus="{$fullscreenfocus}" name="{$expNum}-{$exp->expvar}[]">{$textinputvalue}</textarea></label>
</div>
EOT;
Expand Down Expand Up @@ -582,7 +584,7 @@ function refreshExperimentFormState(){
}
}
}
if( input && !(keyval[1] === 'on' && form.querySelectorAll("[type=checkbox][name='" + keyval[0] + "']")) ){
if( input && !(keyval[1] === 'on' && form.querySelectorAll("[type=checkbox][name='" + keyval[0] + "']")) && keyval[1] !== "" ){
input.value = keyval[1];
input.setAttribute('data-hydrated', 'true');
}
Expand Down

0 comments on commit 4462d50

Please sign in to comment.