Creating a text box and button that will send users to a link that contains info from the text box

sharepoint.stackexchange https://sharepoint.stackexchange.com/questions/216258

  •  22-12-2020
  •  | 
  •  

Domanda

I want to add a text box and a button to my Sharepoint 2013 team site. Users should be able to enter a value into the text box and when they push the button it takes them to an external site where part URL is determined by the value in the text box. So if they enter "121" in the text box they would be taken to http://www.blah.com/121.pdf for instance.

È stato utile?

Soluzione

You can do this by adding a content editor web part. It requires HTML and JavaScript knowledge.

Below small snippet might help

<input type="text" id="txtNumber">
<input type="button" onclick="openPage()" value="Show Page">
<script type="text/javascript">
function openPage() {
    var value1 = document.getElementById('txtNumber').value;
    var url="http://www.blah.com/" + value1 + ".pdf";
   //alert(url);
   window.open(url,"_blank");
}
</script>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top