0

Is it possible to preset a specific URL on the Hyperlink field within newform.aspx page part of SPS2013 List.

Environment: SharePoint 2013

2
  • Can you provide more information such as which link on newform also screenshots would be helpfull Commented May 25, 2016 at 6:59
  • @AnkitkumarMalde, I want the Hyperlink field which is available to be added to SPS2013 list, to have a preset URL, such that while user create a new item, the Hyperlink field has the value already set and user doesn't need to provide any information in the Hyperlink column.
    – Jason
    Commented May 25, 2016 at 7:14

1 Answer 1

0

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.

4
  • Tried for fieldname: Link on my SPS Online and SPS2013, no change. 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
    – Jason
    Commented May 25, 2016 at 14:28
  • Are you sure the internal name of your column is Link? Press F12 in your web browser and check the console for any JavaScript errors.
    – Submits
    Commented May 25, 2016 at 14:30
  • well it worked, now is their an option to hide the columns. Reason I want the value to be set on the hyperlink under newform.aspx, but don't want the user to see, as they may try to change the value. Later when they view on dispform.aspx it will show the hyperlink value. Hope that makes sense, if not, let me know to explain in detail.
    – Jason
    Commented May 26, 2016 at 23:37
  • Alrite, got the way to hide the column using Jscript. Thanks @Submits for the solution on preset address.
    – Jason
    Commented May 27, 2016 at 2:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.