Update using javascript for coral touch ui date picker to show date based on classic ui data

srinivas_chann1

25-07-2019

Hi,

I have to  show the retrieved date data  from crxde which was saved using classic ui dialog  using javascript to  granite/ui/components/coral/foundation/form/datepicker

The data when i retrieved  in javascript comes up as

"Thu Jul 25 2019 12:48:00 GMT+0530"

Now i need to pass this data to coral datepicker  using javascript .

Any inputs or sample code as how i could achieve it

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

srinivas_chann1

28-07-2019

I was trying to read the pageproperties using ajax query to pagepath/jcr:content.json  this was sending request in the above format.

I changed the ajax query to point to servelt and send it back to ajax request and solved the issue

Component dialog details of the field

<Date

         jcr:primaryType="nt:unstructured"

         granite:class=".cq-dialog-field-filldata-parentnode-data"

        

         sling:resourceType="granite/ui/components/coral/foundation/form/datepicker"

         granite:id="datecompId"

         displayedFormat="MMMM DD, YYYY hh:mm a"

         displayTimezoneMessage="{Boolean}true"

         type="datetime"

         fieldLabel="Date"

         name="../../releaseDate">

        </Date>

Step2:-

I created a ajax request based on

Send a Ajax request to servlet

var requestPathWithHtml = $(".foundation-content-path").data("foundationContentPath");

        var requestPath=requestPathWithHtml.replace(/\.[^/.]+$/, "");

  $.ajax({

            type: "GET",

            url: "/bin/requreidserveltpath",

  data:{"pagepath":requestPath},

  contentType: "application/json"

        }).success(function (res) {

$("#datecompId").val(res["pressReleaseDate"]);

}

Answers (0)