选择并禁用组合框

时间:2015-08-18 05:48:53

标签: java jsp

我正在尝试使用以下jstl代码选择和禁用组合框,但只有select工作而不是禁用。如何禁用组合?

CGEventFlags flags = kCGEventFlagMaskShift;
CGEventSetFlags(keyEvent, modifierFlags);

4 个答案:

答案 0 :(得分:0)

请尝试以下代码:

<c:when test="${attCat.catId==fun.GetCatId(date, empList.empId)}">
    <option value="${attCat.catId}" disabled="disabled" >${attCat.category}</option>
</c:when>

我已从selected标记中删除了<option>属性,因为选择禁用的选项没有多大意义。

答案 1 :(得分:0)

disabled="disabled"必须位于<select>,而不是<option>

看到这个小提琴:https://jsfiddle.net/L292Lhw3/1/

更新:请记住,禁用组合框时,不会发布所选值。要发布值,请插入带有预选值的<input type="hidden">

答案 2 :(得分:0)

  

我想保持'已选中'以向用户显示预选值和   禁用同一时间以防止更改。

问题是具有禁用属性的选项将允许用户更改值:

<select>
  <option>Select</option>
  <option selected='' disabled=''>Selected</option>
</select>

您需要使用select代替option代码。

<select disabled=''>
  <option>Select</option>
  <option selected=''>Selected</option>
</select>

答案 3 :(得分:0)

使用selected="true"代替selected="selected"

请参阅this链接

相关问题