0
我有以下選擇標籤:在選擇標籤的Grails NOSELECTION財產在遊樂設施的價值
<g:select name="recommendation" from="${recommendation.list()}"
optionKey="id" optionValue="recommendation"
value="${theAssessment.recommendation}"
noSelection="['':'-- Select Assessor Recommendation --']"
/>
形式按預期工作當值爲null顯示NOSELECTION。當我使用select標籤選擇要提交的數據時,這也可以正常工作,因爲它在數據庫中保留。當我回到表單時,即使值不爲null,noSelection也會返回值。我查看了docs,並且完全按照所述使用了該標籤。
謝謝。解決方案1工作 – kulsoompatel
'?'是什麼?意思? – kulsoompatel
評估?.recommendation?.id使其無效安全,如果(評估)&& if(theAssessment.recommendation)然後顯示ID否則不會使其爲空 – Vahid