diff --git a/src/components/Typeahead.component b/src/components/Typeahead.component index d419a58..7322dc0 100644 --- a/src/components/Typeahead.component +++ b/src/components/Typeahead.component @@ -131,10 +131,15 @@ // put the id on the input tag j$(ctrl).attr('data-id', id); + var selectedId = '{!destinationForSelectedId}'; + var selectedValue = '{!destinationForSelectedValue}'; // if destinations are defined, set them too - j$('[id$={!destinationForSelectedId}]').val( id ); - j$('[id$={!destinationForSelectedValue}]').val( value ); + if(selectedId != '') + j$('[id$='+selectedId+']').val( id ); + + if(selectedValue != '') + j$('[id$='+selectedValue+']').val( value ); }, fieldList: