GEM: ReferencePropertyEditorが表示タイプ「UNIQUE」かつ多重度=1の場合、未入力のリンクを表示しないようにする#1951
Merged
xkazama-yukio3 merged 2 commits intomasterfrom Feb 19, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
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;";
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
対応内容
初期表示時に値が未入力の場合は、リンクを非表示にする。
またリンクに付与するIDも空にする (
nullが指定されないようにする)。fixes #1949