<?php if (!$_POST["defaults"]) { echo script("editingHideDefaults();"); } ?>
<?php echo (support("comment")
? "<label><input type='checkbox' name='comments' value='1' class='jsonly'" . ($comments ? " checked" : "") . ">" . lang('Comment') . "</label>"
- . script("qsl('input').onclick = function () { columnShow(this.checked, 6); toggle('Comment'); if (this.checked) this.form['Comment'].focus(); };")
- . ' <input name="Comment" id="Comment" value="' . h($row["Comment"]) . '" maxlength="' . (min_version(5.5) ? 2048 : 60) . '"' . ($comments ? '' : ' class="hidden"') . '>'
+ . script("qsl('input').onclick = partial(editingCommentsClick, true);")
+ . ' <input name="Comment" value="' . h($row["Comment"]) . '" maxlength="' . (min_version(5.5) ? 2048 : 60) . '"' . ($comments ? '' : ' class="hidden"') . '>'
: '')
; ?>
<p>
?>
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>
+<?php echo script("qs('#form')['defaults'].onclick();" . (support("comment") ? " editingCommentsClick.call(qs('#form')['comments']);" : "")); ?>
this.oninput = function () {};
}
+/** Show or hide comment fields
+* @param [boolean] whether to focus Comment if checked
+* @this HTMLInputElement
+*/
+function editingCommentsClick(focus) {
+ var comment = this.form['Comment'];
+ columnShow(this.checked, 6);
+ alterClass(comment, 'hidden', !this.checked);
+ if (focus && this.checked) {
+ comment.focus();
+ }
+}
+
/** Uncheck 'all' checkbox