0

I have the following code in my JSP that uses Struts2 Now my requirement is to have the headerValue as Pending always in the dropdown box and it should be non-editable

   <td>
        <s:select headerValue="Select" headerKey="" list="#{'Cleared':'Cleared','Exception':'Exception','Pending':'Pending'}" cssClass="select50" id="titleStatus%{#product.productId}">
        <s:param name="name">newContractTitles[<%=counter%>].titleStatus</s:param>
        <s:param name="value"><s:property value="titleStatus"/></s:param>
        </s:select>
   </td>

Please suggest.

Aleksandr M
  • 24,264
  • 12
  • 69
  • 143
Amit Sharad
  • 1,041
  • 3
  • 12
  • 17
  • 1
    then change your `headerValue="Pending always"` ? is that you want if not your question is not clear – Rookie007 Feb 20 '14 at 06:31
  • @looser but I already have 'Pending':'Pending' in the list and can I remove and put it in headerValue ? – Amit Sharad Feb 20 '14 at 06:39
  • 1
    @Barewithme it is `disabled="disabled"` actually. [Read more here](http://stackoverflow.com/questions/6961526/correct-value-for-disabled-attribute) – Andrea Ligios Feb 20 '14 at 10:00

1 Answers1

0

I think you may have to use value attribute of s:select, by setting value ='pending' in select tag.

Mani
  • 283
  • 3
  • 21
  • @Amit Sharad,If I understand your question correctly ,you want default value of "Pending" to be shown in the drop down without making it appear twice.You can use "value" attribute to set the default value and exclude "headervalue" attribute.Let me know if this understanding is incorrect – Mani Feb 20 '14 at 09:00
  • Thanks yes that whats I want also Im writing a function editEnable() which again enables the dropdown so this is what I need – Amit Sharad Feb 21 '14 at 05:00
  • 1
    If you want your select element to be disabled intially and be populated with default value of pending,you can use . Later when you want it to be enabled on some event the JS function can be written as you mentioned ,which would have soemthing like document.formname.elementname.disabled = true; OR document.getelementByid(elementid).disabled = true OR by using jquery like $('#elementid).removeAttr('disabled');Hope this helps. – Mani Feb 21 '14 at 06:06