Skip to content

GEM: ReferencePropertyEditorが表示タイプ「UNIQUE」かつ多重度=1の場合、未入力のリンクを表示しないようにする#1951

Merged
xkazama-yukio3 merged 2 commits intomasterfrom
feature/1949-gem-single-reference-unique-dummy-display
Feb 19, 2026
Merged

GEM: ReferencePropertyEditorが表示タイプ「UNIQUE」かつ多重度=1の場合、未入力のリンクを表示しないようにする#1951
xkazama-yukio3 merged 2 commits intomasterfrom
feature/1949-gem-single-reference-unique-dummy-display

Conversation

@xkazama-yukio3
Copy link
Contributor

対応内容

初期表示時に値が未入力の場合は、リンクを非表示にする。
またリンクに付与するIDも空にする ( null が指定されないようにする)。

fixes #1949

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

本PRは、GEM の ReferencePropertyEditor(表示タイプ UNIQUE かつ多重度=1)において、新規作成など初期表示時に参照未入力(oid が未設定)の場合に「空リンク(oid=null)」が表示されクリックでエラーになる問題(#1949)を防ぐため、未入力時はリンクを非表示にし、リンクに付与するIDも空にする対応です。

Changes:

  • 多重度=1で参照未入力(refEntity.getOid() == null)の場合、リンク用の id/data-linkId と表示ラベルを空に設定
  • 上記の場合、参照リンクを display:none; で非表示化(初期表示時の誤クリック防止)
Comments suppressed due to low confidence (2)

iplass-gem/src/main/resources/META-INF/resources/jsp/gem/generic/editor/reference/ReferencePropertyEditor_Edit.jsp:1482

  • [must] linkDisplayStyle("display:none;") を customStyle の前に連結しているため、customStyle 側に display 指定が含まれると後勝ちでリンクが再表示され、未入力時のリンク非表示が保証されません。display:none が必ず有効になるように、(1) customStyle の後ろに linkDisplayStyle を付ける、または (2) display:none!important を使う、もしくは (3) OID未指定時は style 属性自体を customStyle と分離して確実に hide する、のいずれかで上書きされない形にしてください。
<a href="javascript:void(0)" class="modal-lnk" id="<c:out value="<%=linkId %>"/>" data-linkId="<c:out value="<%=linkId %>"/>" style="<c:out value="<%=linkDisplayStyle%>"/> <c:out value="<%=customStyle%>"/>"
  onclick="<c:out value="<%=showReference %>"/>"><c:out value="<%=dispPropLabel %>" /></a>

iplass-gem/src/main/resources/META-INF/resources/jsp/gem/generic/editor/reference/ReferencePropertyEditor_Edit.jsp:1407

  • [nits] コメントが「ダミーデータを除外」となっていますが、実際には Entity 自体を除外しておらず、OID未指定の場合にリンクのID/表示だけを空・非表示にしています。意図が誤解されやすいので、「未入力(oid==null)時は参照リンクを非表示にする」等、実際の挙動に合わせた表現に修正してください。
			// 多重度1で値が未指定の場合のダミーデータを除外
			if (refEntity.getOid() != null) {
				linkId = propName + "_" + refEntity.getOid();
				dispPropLabel = getDisplayPropLabel(editor, refEntity);
				key = refEntity.getOid() + "_" + refEntity.getVersion();
			} else {
				linkDisplayStyle = "display:none;";

@xkazama-yukio3 xkazama-yukio3 merged commit 11a95b4 into master Feb 19, 2026
3 checks passed
@xkazama-yukio3 xkazama-yukio3 deleted the feature/1949-gem-single-reference-unique-dummy-display branch February 19, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GEM: ReferencePropertyEditorが表示タイプ「UNIQUE」かつ多重度=1の場合、未入力のリンクを表示しないようにする

2 participants