Change default unique value message

Home Forums Classic DFFS Change default unique value message

Viewing 2 reply threads
  • Author
    Posts
    • #22297
      CinderGirl
      Participant

        Is there a way within DFFS to modify the default error message for a unique value field?

        Searched online but all of the examples require adding a webpart to the newform page and I’m not sure how to translate those over for custom JS or if there was a DFFS value I could use.

        Here’s one of the examples:

        
        
        <a href="http://[yoursource]/jquery-1.11.2.min.js">http://[yoursource]/jquery-1.11.2.min.js</a>
        
        $(document).ready(function(){
        $("span[class=ms-formvalidation]:contains('This value already exists')").text('[Insert whatever message you want here...]');
        }); 
        • This topic was modified 6 years, 1 month ago by CinderGirl.
        • This topic was modified 6 years, 1 month ago by CinderGirl.
      • #22303
        CinderGirl
        Participant

          Sigh… I keep putting the block of code in, selecting it, then click the CODE button and it puts apostrophes around it, but when I save it still changes the code. Just FYI since it looks funky.

        • #22323
          Alexander Bautz
          Keymaster

            Hi,
            The problem is that this error doesn’t exist until you try to save. To work around this you can try this in you custom js:

            function dffs_PreSaveAction(){
                var ticker = 0, interval = setInterval(function(){
                    if(ticker > 100){
                        clearInterval(interval);
                    }else{
                        jQuery("span.ms-formvalidation:contains('This value already exists in the list.')").html("New value...");
                        ticker += 1;
                    }
                },50);
            }

            Alexander

        Viewing 2 reply threads
        • You must be logged in to reply to this topic.