Monday, January 26, 2015

datalist html5 options limit

There seems to be a limit to the amount of options that can be provided for the datalist feature which is like a suggestion to textbox, built into html5. here's an example I use:

<datalist id="suggestions">
foreach($getShows as $show){
echo '<option value="'.$show['showname'].'" >';

<input placeholder="Search shows" id="q" name="q" value="<?php if(isset($_GET['q']))echo $_GET['q']; ?>" onkeypress="if (event.keyCode == 13)'?q='+this.value,'_self')" list="suggestions" />
<img src="images/search.gif" onclick="'?q='+document.getElementById('q').value,'_self')" style="cursor:pointer">

If this makes sense to you, know this; the limit from my testing for today's version of google chrome (40) is about 100, maybe 130 but didn't always work.

UPDATE Jan 28, 2015: It seems the issue was with the queries and there were too many for the server to load or something. Works with larger amounts (over 200).

Let me know what methods you use for this if any and if you use this feature. Thanks.

No comments: