Thanks kbwood. That did what I wanted it to. However I'm still not very comfortable with Jquery syntax, so if you know a better way of doing this please let me know anybody.
I also want to do two other things:
1. Put a message on the new page "You selected..." However with the code below, this appears on the old page and even then it no longer recognises the value of the variables.
2. Display ui.item.label in the input on the old and new page. At the moment it just shows ui.label.value on the old page and is blank on the new page. Note the new page is essentially the same as the old one, but just has a new image and uses the same program.
Any help gratefully received!
- var GridId = $("#grid").val();
$(function() {
$( "#tags" ).autocomplete({
source: availableTags , select: function(event, ui) { $(this).val(ui.item.label);
var SelectedId = $(this).val(ui.item.value);
findURL(SelectedId,GridId);
$("#myForm").submit();
$("p").html("<b>You selected:</b> " + SelectedId + " <b>in:</b> " + GridId );}
});
});
<form id="myForm">
<input id="tags" name="regions_category_id" />
<input type="hidden" name="grid" value="{$grid}"/>
</form>