Menu

#504 Validate DOI ids on input

6.8.0
closed
None
Unknown
Improvement
Unknow
Unknow
Unknow
2024-02-07
2022-12-13
No

Related

News: 2024/01/wikindx-v680-release-candidate-1
News: 2024/02/wikindx-v680-release-candidate-2
News: 2024/02/wikindx-v680

Discussion

  • Stéphane Aulery

    • status: pending --> closed
     
  • Stéphane Aulery

    Hi Mark,

    I added a JS/PHP functions to validate DOI numbers.

    Could you

    Regards,

     
    • Mark Grimshaw

      Mark Grimshaw - 2024-02-07

      Hi Stéphane,

      I assume it's in the resource form, but, when I add or edit a resource with a DOI that itself produces a 404, nothing happens and the resource is added/edited without problems.

      Mark

       
      • Stéphane Aulery

        HTTP 404 error ? Odd.

        I ended by adding myself a JS validation. Try to refresh the resource form and try again. Now you should see the DOI input box with a red border in case of error.

         
        • Mark Grimshaw

          Mark Grimshaw - 2024-02-07

          Ahhhh. Looking at the code, I now understand what it does. Entering '10.30app14031038' does produce the warning. So it's working as you intended.

          I thought DOI validation was about checking that the DOI address existed. '10.30/app14031038' (which is validated by your code) is an address that does not exist.

          Mark

           
          • Stéphane Aulery

            Yes, it doesn't check if the document exists. Just the syntax, which is the minimum.

             
            • Mark Grimshaw

              Mark Grimshaw - 2024-02-07

              Then all is well. I guess if we wanted to check in the URL exists (and for other elements too, not just DOI), then, after validation, we could use something like:

              var request = new XMLHttpRequest();  
              request.open('GET', 'http://www.mozilla.org', true);
              request.onreadystatechange = function(){
                  if (request.readyState === 4){
                      if (request.status === 404) {  
                          alert("Oh no, it does not exist!");
                      }  
                  }
              };
              

              Mark

               
              • Stéphane Aulery

                It is not uncommon that a university or a company does not have the right to send requests externally without going through a proxy. This is even very often the case. Also this makes this feature more difficult to implement than that. I don't want to venture into that territory.

                 
                • Mark Grimshaw

                  Mark Grimshaw - 2024-02-07

                  Understood.

                   
  • Mark Grimshaw

    Mark Grimshaw - 2024-02-07
    • status: closed --> open
     
  • Mark Grimshaw

    Mark Grimshaw - 2024-02-07
    • status: open --> closed
     

Log in to post a comment.