Tapestry make选择必填项

时间:2015-03-18 18:37:27

标签: tapestry

我想用Select创建一个下拉列表,我希望在其中有一个默认值("选择一些")。

默认我得到了但我怎么强迫"强迫"用户可以从选择输入中进行选择吗? 我承诺时应该抓住它的价值吗?有没有更清洁的方式?

1 个答案:

答案 0 :(得分:0)

尝试“验证”。

像这样工作:

<t:zone t:id="modelZone" id="modelZone">
         <t:if test="yourZoneTestVariable">
           <p>
              <t:select t:id="selectId" model="yourModel" validate="required"/>
           </p>
         </t:if>
      </t:zone>

希望这会对你有所帮助。

此处有更多信息(尽管对于挂毯初学者来说很难阅读): http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/corelib/components/Select.html