Page Extension with NVelocity Variables

There are some scenarios where we want to dynamically generate variables on the server side and use them on the client in JavaScript or jQuery.

A specific case for this in the context of EngageIP is when working with the Package screen through a page extension, particularly when you need to do an action when you add a new service or similar.

Since the page is rendered dynamically as you add new components there is no way to know the new page blocks rendered in a Ajax response and their element IDs.

To manage this will need to create a Page Extension that will be attached to the Ajax call request. So for example if we need to uncheck the “Bill Now” checkbox on a user service, we will create a page extension attached to the AJAX method associated with the request.  In this case, it’s:

Page: AJAXCreateService

Script:

jQuery("input[name='checkbox_${prefix}Service${serviceNum}^Bill Now']").attr("checked",false); document.getElementById("${prefix}Service${serviceNum}^Bill Now").value ="false";

Now when you add a new service on a user package the Bill Now checkbox will be unchecked.