How to pass an array as a hidden field?

I am implementing an auto complete box using the Ajax.autocompleter method of the scriptaculous.js framework.

This is the auto complete box and the div where the auto suggested entries are populated.

<?php echo $form->create('Share', array('url' => '/forms/share')); ?>
    
    
    
<?php echo $form->end('Share');?>

This is the JQuery function to get the auto-suggested list and to get the id of the selected entry which is stored in the hidden field of the form.

new Ajax.Autocompleter("autocomplete", "autocomplete_choices",
                       "http://localhost/FormBuilder/forms/autoComplete",
		                   {  
                            tokens: ',',
        				   afterUpdateElement : getSelectedId
                           }
                       );

function getSelectedId(text, li) {
	    $("#sharedUserId").val(li.id);
}

Suppose if I select multiple entries,how to send those values?
Can I have an array as a hidden field, so that I can have an array of the selected elements and save that array as a hidden field?