Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
linenumberstrue
<script type="text/javascript">

$(document).ready(function () {

    $("#resend").off("click");
    
    $("#resend").on("click", function (event) {
        console.log('enter resend');
        FormUtil.getField("status").val("resendOTP");
        $("#assignmentComplete").focus().click();
        return false;
    });

    $("#changeTo").off("click");

    $("#changeTo").on("click", function (event) {
        console.log('enter changeConfirm');
        FormUtil.getField("status").val("changeConfirm");
        $("#assignmentComplete").focus().click();
        return false;
    });
}); 

</script>

Using page_loaded event to simulate a page refresh

Since DX 8 Themes have the Single Page Application (SPA) treatment, some scripts that depends and load on page opened / refresh might not work as intended.

consider the following script, where it is used to capture the current URL that the page is on : 

Code Block
languagejs
$(document).ready(function(){
	var currentUrl = window.location.href;
	console.log("URL : "+currentUrl);
});


On your first page visit, the console will output the intended output, which is the url of the current page that you are in.

however, as you navigate to other menus and pages in the app, the above code will not fire due to the SPA treatment and the page does not get refreshed. 

This is where the event "page_loaded" comes in handy. you can simulate a page refresh and modify the above code to behave as if the page is reloaded like so : 


Code Block
languagejs
$(document).ready(function(){
    $(document).on("page_loaded", function(){
    	var currentUrl = window.location.href;
    	console.log("URL : "+currentUrl); 
    })
});