Kushan
Kushan

Reputation: 10703

How to use placeholder attribute in <form:select>?

My jsp code like this,

<form:select path="metaFieldId" cssStyle="width: 190px;" placeholder="Select Filter"    onchange="selectMetaField(${metaFieldId})">
    <form:option value="" label="" />
    <form:options items="${metaFields}" itemLabel="name" itemValue="id" />
</form:select>

Can anybody help my?

Upvotes: 0

Views: 2773

Answers (1)

BMH
BMH

Reputation: 4340

In HTML select tag does not support placeholder attribute. If you use select you can use the first option to display the placeholder text:

<form:select path="metaFieldId" cssStyle="width: 190px;" onchange="selectMetaField(${metaFieldId})">
    <form:option value="" label="Select Filter" />
    <form:options items="${metaFields}" itemLabel="name" itemValue="id" />
</form:select>

Upvotes: 6

Related Questions