Programatically Fire the Validate Button

Posted by: jonathan.nachman on 15 April 2025, 10:54 am EST

  • Posted 15 April 2025, 10:54 am EST

    Hi Guys , was wondering if there is a option to programatically fire validate, or understand exactly what its doing as at the moment ive set up a data source but have to click validate every time.

    As the data is different i dont know what it will look like , so this is needed every time.

    Thanks in advance

  • Posted 17 April 2025, 2:58 am EST

    Hi Jonathan,

    Since the API for Validate button is not public, I would suggest adding an event handler (say keydown(shortcut key) or input change) as per your use case and click the Validate button present in the DOM.

    Sample Code:

     document.addEventListener("keydown", (e) => {
            if (e.key === "Enter") {
              const designerHost = document.querySelector("#designer-host");
              if(!designerHost) {
                console.warn("Designer host not found.");
                return;
              }
              const buttons = designerHost.querySelectorAll(".ed-dataset-dialog .gc-modal__footer button");
        
              const validateButton = Array.from(buttons).find((button) => {
                const span = button.querySelector("span");
                return span && span.textContent.trim() === "Validate";
              });
        
              if (validateButton) {
                console.log("Clicking Validate button:", validateButton);
                validateButton.click();
              } else {
                console.warn("No Validate button found.");
              }
            }
          });
    

    I hope this helps!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels