Get page path or component path inside dialog field validator | Community
Skip to main content
May 20, 2019
Solved

Get page path or component path inside dialog field validator

  • May 20, 2019
  • 1 reply
  • 1924 views

How can I get the current page path e.g. /content/site/en/pageName or the current component path e.g. /content/site/en/pageName/jcr:content/component from within a dialog field validator (foundation.validation.validator)

registry.register("foundation.validation.validator", {

    selector: "[data-foundation-validation=someValidator]",

    validate: function(el) {

     // Some code to get page or component URL to make AJAX call

    }

});

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

Hi,

use below -

var page = Granite.author.pageInfoHelper.json.status.path

1 reply

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
May 20, 2019

Hi,

use below -

var page = Granite.author.pageInfoHelper.json.status.path

Arun Patidar
August 26, 2020
Will this works for publisher too?