Is it possible to preset a specific URL on the Hyperlink field within newform.aspx page part of SPS2013 List.
Environment: SharePoint 2013
Is it possible to preset a specific URL on the Hyperlink field within newform.aspx page part of SPS2013 List.
Environment: SharePoint 2013
You can do this with a bit of JavaScript on the page.
Edit the newform.aspx page and add a Script Editor web part with this code (note the use of jQuery hosted by Google:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
var internalNameOfUrlField = "hyperLinkFieldName";
var urlToSet = "http://www.google.com";
$("[id^='" + internalNameOfUrlField + "'][id$='UrlFieldUrl']").val(urlToSet);
</script>
Change the values of the internalNameOfUrlField
and urlToSet
variables to what ever is appropriate for your case.
code
<script type="text/javascript" src="ajax.googleapis.com/ajax/libs/jquery/1.12.4/…> <script> var internalNameOfUrlField = "Link"; var urlToSet = "google.com"; $("[id^='" + internalNameOfUrlField + "'][id$='UrlFieldUrl']").val(urlToSet); </script> code
Link
? Press F12 in your web browser and check the console for any JavaScript errors.