I'm working on a custom New/Edit Form for a SharePoint list with JavaScript. I am hiding fields that I don't want the user to see, and requiring other fields. I have not had trouble hiding the fields I don't want the users to see. Yet, I am requiring the URL/Hyperlink input, and having a problem with the input. Yes, the address field is required, as I want, but also, I need the user to enter information in the Description field for the hyperlink address. Is it possible to force this secondary field in the column entry to be required?


I haven't tested this, but I think you can add the HTML5 required-property to the Description-field followingly:

| improve this answer | |
  • I believe that would work fine with the standard HTML5 input declaration. Yet, this is done from SharePoint with an ASPX file. I have found some potential information regarding it, martinhatch.com/2013/08/… . But nothing pertaining to a Hyperlink list item. They are a little different. Thanks though. – Matthew Dewell Oct 31 '16 at 13:32
  • Nothing stops you from inserting a Content Editor Web Part with a JS-file including this jQuery to the EditForm.aspx of your list. – moe Oct 31 '16 at 13:34
  • Sounds interesting. How should I alter the actions of the NewForm.aspx and EditForm.aspx with the CEWP? I've only currently been using the JS Link Miscellaneous option with the list forms, New and Edit. – Matthew Dewell Oct 31 '16 at 13:52
  • You can add the CEWP to your EditForm.aspx and to NewForm.aspx by going to cogwheel > Edit page and inserting the wp while on either of the pages. Then edit the wp and input the link to your file containing the above jQuery to the Content Link -field. This needs to be done for both of your pages. – moe Oct 31 '16 at 13:59
  • 1
    Note: JSLink is the SP2013 way of linking a script file, CEWP is the (old) SharePoint way of linking a Scriptfile. They both do the same. Benefit of a CEWP after! the ListForm webpart is that you know all Form HTML is in the DOM, with JSLink you have to add code to wait for the DOM to be ready (eg. jQuery ready function) JSLink can also be used to load jQuery because it accepts any https address (in SharePoint online) – Danny '365CSI' Engelman Nov 1 '16 at 14:26

OK! I finally got a solution. It was a little tricky to do, and find information for, but I think I got it. I had to go about detecting if the URLFieldDescription was blank or not. I did this by adding $.fn.extend code to the JSLink file, like this:

    vals: function () {
        var retVals = []; 

        this.each(function () {

        return retVals; 

var formInputs = "[id*='URLFieldDescription']";

$(formInputs).bind('keyup keydown change', function () {
    var entries = $(formInputs).vals();

    for (i in entries) {
        if (entries[i] == '') {

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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