We are using local storage to hold a text box/title value from a 'main' problem list. In this 'main' list, we first identify the issue/problem. We then add tasks in a task list associated to the 'main' problem list identified above.
We are running into a roadblock of trying to use localStorage to populate a choice field in the task list. We can hard code the value, and have the task's choice field get populated/selected properly. If we use a localStorage variable/value, the choice field will not populate/select properly. Below code shows where we have "test 2 Option" hard coded, and this works properly. If we used the line right below (currently commented out) with localStorage, nothing happens on the choice dropdown. The alert tells us we have localStorage correctly, and in Chrome + Inspect / Resources / Local Storage, I can see the Key & Value pair successfully:
<script>
$(function() {
var selectedText = "test 2 Option";
//localStorage.getItem("lclstrgTaskTitle");
$('#Problem_myLIST84dfa1dccc5b_\\$LookupField option').map(function () {
if ($(this).text() == selectedText) return this;
}).attr('selected', 'selected');
alert(localStorage.getItem("lclstrgTaskTitle"));
}
)
</script>
Please advise...thank you!