From 6e86585b9c5356ecd15ee176ec9b13a55457c2a4 Mon Sep 17 00:00:00 2001 From: EdGuz Date: Mon, 6 Mar 2017 17:03:51 -0400 Subject: [PATCH] Updated TypeAhead component Added logic to not attempt to add destinationForSelectedId and destinationForSelectedValue when these attributes are assigned, since these attributes are not required they cause an error when they don't have a value. --- src/components/Typeahead.component | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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: