Hide form parts with the hidden attribute.

This commit is contained in:
tim
2026-09-26 15:27:51 +02:00
parent 65426a327d
commit 716a609f4e
6 changed files with 27 additions and 16 deletions
+6 -6
View File
@@ -8,15 +8,15 @@ function showHide(show) {
}
if (show == 'text') {
document.getElementById(hide+'parent').style.display = "none";
document.getElementById(show+'parent').style.display = "block";
document.getElementById('wordcounter').style.display = "block";
document.getElementById(hide+'parent').hidden = true;
document.getElementById(show+'parent').hidden = false;
document.getElementById('wordcounter').hidden = false;
if (window.storyEditor)
storyEditor.focus();
} else if (show == 'upload') {
document.getElementById('wordcounter').style.display = "none";
document.getElementById(hide+'parent').style.display = "none";
document.getElementById(show+'parent').style.display = "block";
document.getElementById('wordcounter').hidden = true;
document.getElementById(hide+'parent').hidden = true;
document.getElementById(show+'parent').hidden = false;
}
// Mark the tab that is showing
+4 -4
View File
@@ -48,7 +48,7 @@ if (count($validate) !== 0) {
<div class="tabs">
<span id="texttab" class="tab active<?= isset($validate['story']) ? ' red' : '' ?>" onclick="showHide('text');">Text:</span>
<span id="uploadtab" class="tab<?= isset($validate['upload']) ? ' red' : '' ?>" onclick="showHide('upload');">Image:</span>
<span id="wordcounter" class="counter" style="display: none;">0 words</span>
<span id="wordcounter" class="counter" hidden>0 words</span>
</div>
<?php $line_break_note = '(To get line-breaks&mdash;as in poetry&mdash;instead of paragraph breaks, hit shift-enter instead of enter.)'; ?>
<div class="textarea rightcolumn">
@@ -58,7 +58,7 @@ echo (isset($story) ? form_value($story) : '')
?></textarea>
<div class="note"><?= $line_break_note ?></div>
</div>
<div id="uploadparent" style="display: none;">
<div id="uploadparent" hidden>
<div class="upload"><div>
<?php
if (isset($file_src) || isset($img)) {
@@ -102,7 +102,7 @@ if (isset($file_src) || isset($img)) {
<input type="hidden" id="editor" name="editor" value="original author" />
<?php } ?>
<div style="display: none;">
<div hidden>
<input type="hidden" id="date" name="date" value="<?= isset($date) ? form_value($date) : '' ?>" />
<input type="hidden" id="id" name="id" value="<?= isset($id) ? form_value($id) : '' ?>" />
</div>
@@ -151,7 +151,7 @@ if (isset($file_src) || isset($img) || isset($validate['upload'])) {
echo " showHide('upload')\n";
} else {
echo " var wordcounter = document.getElementById('wordcounter');\n";
echo " wordcounter.style.display = 'block';\n";
echo " wordcounter.hidden = false;\n";
}
echo "</script>\n";
?>