getting the var element to focus or blur
I am using the below javascript along with infopath.
This code helps to get the substring of the URL and then depending on the text, it assigns value to the
control. However, the way it is done here is using a var
Now, once the var is assigned the value when we click on the save button, it is not saved.
I want to issue a blur or focus for the control to which this var is referring to.
Could you please help me ?
- <script type="text/javascript">
- //_spBodyOnLoadFunctionNames.push("displayABC");
-
- window.onload = function() {
- window.setTimeout(displayABC, 1000);
- }
-
-
- function displayABC()
- {
-
- var prevURL=document.referrer;
- alert(prevURL);
-
- if (prevURL.indexOf("/UAT/PL/Report") !=-1)
- {
- //alert("hi!");
- var inputFieldCollection = document.getElementsByTagName("input");
-
- for (itemIndex = 0; itemIndex < inputFieldCollection.length; itemIndex++)
- {
-
- var inputItem = inputFieldCollection[itemIndex];
- if (inputItem.title)
- {
- var valuePos = inputItem.title.indexOf("=");
-
- if (valuePos != -1)
- {
- alert(valuePos);
- inputItem.value = "Abc";
- nputFieldCollection[itemIndex].focus();
- }
- }
- }
- }
- }
-
- </script>