Set initial JQuery suggest value
<p>I have a JQuery suggest box using a key and a value. The key is the saved value, for example a userId and the value is the shown value such as a username.</p>

<p>When having a blank field it works great. I type a few characters, select a name and the value is added as the value that is posted with the HTTP request. Now, how should I prefill a form's suggest with when it already has a value. When placing the saved userId as the value the suggest shows the userId but, obviously I want to show the username. I also tried to echo the username that was selected but than, if the username is not changed the posted value will be the username. </p>

<pre><code>                &lt;script&gt;
                &lt;!--
                $(document).ready(function() {
                    $("#creatorUserId").autocomplete("Gateway.php?action=UserAction&amp;subAction=suggest",{
                        parse: function(data) {
                            var parsed = [];
                            data = data.data;

                            for (var i = 0; i &lt; data.length; i++) {
                                parsed[parsed.length] = {
                                    data: data[i],
                                    value: data[i].key,
                                    result: data[i].value
                                };
                            }

                            return parsed;
                        },
                        formatItem:function(item, index, total, query){
                            return item.value;
                        },
                        formatResult:function(item){
                            return item.id;
                        },
                        dataType: 'json'
                    });
                });
                --&gt;
                &lt;/script&gt;   

&lt;input type="text" name="creatorUserId" id="creatorUserId" value="3" size="40" /&gt;
</code></pre>

<p>How could I solve this?</p>
