項目の上下に注記バッジを表示する
項目ごとに色や余白を直接書く代わりに、共通CSSと短いHTMLで注記を表示します。入力欄の上下に置く注記バッジを対象とします。表示はCSSだけで行い、任意で管理画面のタグ挿入補助スクリプトを追加できます。Bootstrapの導入は不要です。

設定する場所
「テーブルの管理」→「エディタ」で項目を選択し、詳細設定の拡張HTMLの「コントロールの後」に次を設定します。保存対象は列設定のExtendedHtmlAfterControlです。一覧のフィルタなどを増やす拡張フィールドとは別の設定です。
<div class="vhub-field-note alert-success">集計後の合計を確認してください。</div>vhub-field-noteは配布CSSで定義する独自クラスです。入力欄の内容や計算処理は変更しません。既存の注記を移すときは、元の位置のHTMLを消して二重表示を避けます。ボタン・リンクを使う操作用HTMLは、注記と区別して残します。
共通CSSの登録
/* Default message state missing from the standard Pleasanter alert set. */
.alert-default {
display: block;
min-height: 32px;
padding: 5px;
color: var(--base-text, var(--nonColor02));
background-color: var(--base-bg, var(--nonColor16));
border: 1px solid var(--base-border, var(--nonColor11));
}
/* Shared field-note style. All colors come from the active Pleasanter theme. */
.vhub-field-note {
--vhub-note-bg: var(--base-bg, var(--nonColor16));
--vhub-note-text: var(--base-text, var(--nonColor02));
--vhub-note-border: var(--base-border, var(--nonColor11));
box-sizing: border-box;
display: block;
width: 100%;
min-height: 0;
max-width: 100%;
margin: 6px 0 0;
padding: 4px 9px;
border: 1px solid var(--vhub-note-border);
border-radius: 4px;
background: var(--vhub-note-bg);
color: var(--vhub-note-text);
font-size: 12px;
font-weight: 500;
line-height: 1.65;
text-align: start;
white-space: normal;
overflow-wrap: anywhere;
}
.vhub-field-note:is(.alert-default, .vhub-field-note--default) {
--vhub-note-bg: var(--base-bg, var(--nonColor16));
--vhub-note-text: var(--base-text, var(--nonColor02));
--vhub-note-border: var(--base-border, var(--nonColor11));
}
.vhub-field-note:is(.alert-success, .vhub-field-note--success) {
--vhub-note-bg: var(--success-color, var(--commonColor07));
--vhub-note-text: var(--invert-text, var(--nonColor16));
--vhub-note-border: var(--success-color, var(--commonColor07));
}
.vhub-field-note:is(.alert-error, .vhub-field-note--error) {
--vhub-note-bg: var(--warning-color, var(--commonColor01));
--vhub-note-text: var(--invert-text, var(--nonColor16));
--vhub-note-border: var(--warning-color, var(--commonColor01));
}
.vhub-field-note:is(.alert-warning, .vhub-field-note--warning) {
--vhub-note-bg: var(--commonColor05);
--vhub-note-text: var(--base-text, var(--nonColor02));
--vhub-note-border: var(--commonColor06);
}
.vhub-field-note:is(.alert-information, .alert-info, .vhub-field-note--info) {
--vhub-note-bg: var(--primarySub04);
--vhub-note-text: var(--primaryDark, var(--primaryColor));
--vhub-note-border: var(--primarySub01);
}
.vhub-field-note > :first-child { margin-block-start: 0; }
.vhub-field-note > :last-child { margin-block-end: 0; }
.vhub-field-note a { color: inherit; text-decoration: underline; }
.vhub-field-note code { font-size: inherit; }
.vhub-field-note--above { margin: 0 0 6px; }
@media print {
.vhub-field-note { box-shadow: none; }
}
/* ExtendedHtmlAfterControl is a sibling of Pleasanter's floated field-control. */
:is(.field-normal, .field-wide, .field-textarea, .field-markdown):has(> .vhub-field-note) {
height: auto;
min-height: 4em;
}
:is(.field-normal, .field-wide, .field-textarea, .field-markdown) > .vhub-field-note {
--vhub-field-note-label-offset: 120px;
clear: both;
margin-inline-start: var(--vhub-field-note-label-offset);
width: calc(100% - var(--vhub-field-note-label-offset));
max-width: calc(100% - var(--vhub-field-note-label-offset));
}
.no-field-label :is(.field-normal, .field-wide, .field-textarea, .field-markdown) > .vhub-field-note {
--vhub-field-note-label-offset: 0px;
}サイト単位なら「テーブルの管理」のスタイルに全文を登録し、新規作成・編集画面を対象にします。共通化する場合はExtensionsに次の定義を登録します。
| 項目 | 値 |
|---|---|
| ExtensionType | Style |
| ExtensionName | FieldNote.css |
| ExtensionSettings | {}のJSON文字列。必要なら対象サイトで絞り込む |
| Body | 配布CSSの全文 |
| Disabled | 初回はtrue、確認後にfalse |
DB定義を更新したらパラメータを再読込し、画面を開き直します。APIの更新では省略値を保持する前提にせず、管理中の全項目を送ります。詳細はExtensionsテーブルとパラメータを参照してください。
色の指定
| HTMLのクラス | 用途 | 主なテーマ変数 |
|---|---|---|
| alert-default | 通常の説明 | base-bg・base-text・base-border |
| alert-success | 入力のヒント・確認済み | success-color・invert-text |
| alert-error | エラーの説明 | warning-color・invert-text |
| alert-warning | 注意事項 | commonColor05・commonColor06 |
| alert-information | 補足情報 | primarySub04・primaryDark |
標準テーマのwarning-colorはエラー系の赤色に対応します。黄色系のwarningバッジとは対応変数が異なります。
defaultは、ceruleanでは白地・黒文字です。他のテーマではそのテーマの背景色と文字色へ追従します。色をコードへ固定せず、色だけに意味を持たせない説明文にします。
位置と折り返し
標準画面では、拡張HTMLが入力コントロールの兄弟要素になります。CSSではfloatを解除して注記を次の行に送り、フィールドの高さを自動にします。ラベル分の120pxを空けるため、注記の左右端と幅が入力欄の領域に揃います。短い文でも同じ幅になり、長文は折り返します。
独自のラベル幅を使う場合は、対象項目だけ変数を上書きします。
#Results_ClassAField > .vhub-field-note {
--vhub-field-note-label-offset: 140px;
}ラベル非表示のno-field-label配下では余白を0にします。長い文は折り返します。:has()・:is()に対応するブラウザを使用してください。横に並ぶ項目をすべて同じ高さにする機能ではありません。上置きもコントロール領域と同じ幅にできます。隣の項目の高さまで自動で揃える機能ではありません。
管理画面に挿入ボタンを追加する
注記のHTMLを毎回手で入力する代わりに、項目の詳細設定の「拡張HTML」に挿入ボタンを追加できます。表示用CSSに加え、次の拡張スクリプトを登録します。プリザンター本体の変更やAPIキーは不要です。
| 項目 | 値 |
|---|---|
| ExtensionType | Script |
| ExtensionName | FieldNoteEditor.js |
| ExtensionSettings | {"Controllers":["items"],"Actions":["edit"]} のJSON文字列 |
| Body | スクリプトの全文 |
| Disabled | 初回はtrue、確認後にfalse |
登録・有効化後はパラメータを再読込します。既に開いている管理画面にボタンが出ない場合は、ブラウザのキャッシュを更新して開き直してください。
- 「テーブルの管理」→「エディタ」で項目を選び、「詳細設定」→「拡張HTML」を開きます。
- 「ラベルとコントロールの間」の補助入力は上置き、「コントロールの後」の補助入力は下置きです。使う側の入力欄へ注記文を入力します。
success・default・information・warning・errorから種類を選びます。既定はsuccessです。- 「注記タグを挿入」を押すと、対象の拡張HTML欄の末尾にタグを追加します。
- 標準の「変更」→「更新」で保存します。
挿入ボタンは編集中の欄だけを変更し、自動保存しません。既存HTMLや選択範囲を上書きせず、既にある注記を自動で移動・置換することもありません。同じ文を二重に挿入した場合はHTML欄で調整してください。空の文は挿入しません。
入力文中の<・>・&・引用符はHTMLとして解釈されないよう変換します。太字やリンクなどのHTMLを入力するボタンではありません。必要な装飾は、挿入後にHTML欄を直接編集します。
上置きではvhub-field-note--aboveを付けます。通常のレコード編集画面にはボタンを追加せず、項目設定のダイアログだけが対象です。Ajaxによるダイアログの作り直しを管理エディタ内で監視し、同じ入力欄に補助が重複しないようにしています。
挿入補助スクリプトの全文
/* Field-note insertion helpers for the standard column settings dialog. */
$(function () {
'use strict';
var targets = [
{ id: 'ExtendedHtmlBetweenLabelAndControl', label: '上置き', above: true },
{ id: 'ExtendedHtmlAfterControl', label: '下置き', above: false }
];
function escapeHtml(value) {
return value.replace(/[&<>"']/g, function (c) {
return { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c];
});
}
function install() {
targets.forEach(function (target) {
var area = document.querySelector('#EditorColumnDialog #' + target.id);
if (!area || area.parentElement.querySelector('.vhub-note-editor')) return;
var bar = document.createElement('div');
bar.className = 'vhub-note-editor';
bar.style.cssText = 'display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:6px 0';
var text = document.createElement('input');
text.type = 'text';
text.className = 'control-textbox';
text.placeholder = '注記文を入力';
text.setAttribute('aria-label', target.label + 'の注記文');
text.style.cssText = 'flex:1 1 200px;width:auto;min-width:120px';
var tone = document.createElement('select');
tone.className = 'control-dropdown';
tone.style.width = 'auto';
tone.setAttribute('aria-label', target.label + 'の注記の種類');
['success', 'default', 'information', 'warning', 'error'].forEach(function (key) {
tone.add(new Option(key, key));
});
var button = document.createElement('button');
button.type = 'button';
button.className = 'button button-neutral';
button.textContent = '注記タグを挿入(' + target.label + ')';
var message = document.createElement('span');
message.setAttribute('role', 'status');
message.style.fontSize = '12px';
button.addEventListener('click', function () {
if (!text.value.trim()) {
message.textContent = '注記文を入力してください。';
text.focus();
return;
}
var content = '<div class="vhub-field-note alert-' + tone.value
+ (target.above ? ' vhub-field-note--above' : '') + '">'
+ escapeHtml(text.value) + '</div>';
// Append without replacing existing HTML or a selected range.
area.value += (area.value && !area.value.endsWith('\n') ? '\n' : '') + content;
$(area).trigger('input').trigger('change');
area.focus();
area.setSelectionRange(area.value.length, area.value.length);
message.textContent = '挿入しました。標準の「変更」→「更新」で保存してください。';
});
bar.append(text, tone, button, message);
area.insertAdjacentElement('afterend', bar);
});
}
$(document).on('dialogopen.vhubNoteEditor', '#EditorColumnDialog', install);
var editor = document.getElementById('Editor');
if (editor) new MutationObserver(function (changes) {
if (changes.some(function (change) { return change.addedNodes.length; })) install();
}).observe(editor, { childList: true, subtree: true });
install();
});
挿入ボタンや注記を外す
挿入ボタンだけを外す場合は、FieldNoteEditor.jsの定義を無効化してパラメータを再読込します。登録済みの注記HTMLは残ります。
注記自体をなくす場合は、各項目の追加HTMLから注記タグを削除します。すべての注記でCSSが不要になったら、専用Styleも無効化して再読込します。項目に保存された値は変わりません。
関連ソース
根拠は項目拡張HTMLの出力とceruleanのテーマ変数です(参照日2026-11-03)。