当前位置: 代码迷 >> Java相关 >> freemarker
  详细解决方案

freemarker

热度:9070   发布时间:2013-02-25 21:51:50.0
freemarker求助
我想讲这个select改成checkbox

<@html.select
styleId="${sectionName}.${field.fieldColumnName}.${itemList_index}_disabled"
name="${sectionName}"
property="${sectionName}.${field.fieldColumnName}"
value="${field.value?if_exists}"
id="${sectionName}.${field.fieldColumnName}.${itemList_index}"
styleClass="${field.fieldJSValidation?if_exists?html}"
style="width:180px"
title="${sectionTitleCurrentLanguage}${macroHelper.getCurrentLanguage(frequest,field.fieldTitle)?if_exists?html}"
onchange="${fieldJsfunction}">
<@html.option value="">-----------------------</@html.option>
<#if (field.paramsMap[form.params.sqlID]?exists && field.paramsMap[form.params.sqlID] !='') || (field.paramsMap[form.params.sourceName]?exists && field.paramsMap[form.params.sourceName] !='')>
<@html.optionsCollection
name="${sectionName}"
property="${field.fieldColumnName}ResultList"
label="${field.paramsMap[form.params.label]?html}"
value="${field.paramsMap[form.params.value]?html}"/>
</#if>
</@html.select>




------解决方案--------------------------------------------------------
改成这样试试


<#if (field.paramsMap[form.params.sqlID]?exists && field.paramsMap[form.params.sqlID] !='') || (field.paramsMap[form.params.sourceName]?exists && field.paramsMap[form.params.sourceName] !='')>
<@nested.iterate property="${field.fieldColumnName}ResultList">
${field.paramsMap[form.params.label]?html}:<input type="checkbox" name="${sectionName}.${field.fieldColumnName?if_exists}" id="${section.sectionName}.${field.fieldColumnName?if_exists}.${itemList_index}"
value="${field.paramsMap[form.params.value]?html}" class="noBorder" 
<#include 'fieldJSfunction.ftl'>
<#if fieldJsfunction?exists && fieldJsfunction !='N'>
onclick="${fieldJsfunction}"
</#if>
<#if (field.fieldReadOnly?exists && '1' == field.fieldReadOnly)>
readonly="readonly"
</#if> 
/>
</@nested.iterate>
</#if>