Question

I have a combobox that is populated by JSP using JSON. The autocomplete functionality works beautifully however when I select on an item a lot of white space gets added into where the selected item is displayed.

If I leave it as is without the combobox function then the selected item appears normally without all the extra white space. Any idea what's going on here? I'd like to keep it as a combobox to fit the rest of the page. It's only this particular one that seems to be behaving like so.

<select id="box1">
   <option value=""></option>
      <core:forEach var="msg" items="${message}">
           <option value="<core:out value='${msg.messageValue}'/>">
               <core:out value="${msg.messageAlias}"/>
           </option>
      </core:forEach>
</select>

<script>
$(document).ready(function(){
 $('#box1').combobox();
});

</script>
Was it helpful?

Solution

In case anyone else comes across this problem, I've found out what the issue was. Turns out jsp doesn't like how I had my options tag indexed so I just had to move everything to one line and that fixed it.

<option value="<core:out value='${msg.messageValue}'/>"><core:out value="${msg.messageAlias}"/></option> 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top