Wizard Page Decision Making

Below is an sample of decision making for the progression onto the next wizard page based on a radio button input. This could be easily adaptable for any other type of fields.

The wizard pages are referenced by name in the code.


$.njDialerPlugin.getPage('${NjWizardPageName}').onPageNext = function(page,defaultNextPage) {
	// default to stay on current page if no button selected
	var nextPage = page;	
    
	// get the value of the field
    var donationQuery = $.njDialerPlugin.getFieldValue("DonationQuery");
    
	// decision based on field value
    if (donationQuery == "already_help_other_charities")
        nextPage = $.njDialerPlugin.getPage("Already Help");
    else if (donationQuery == "not_sure_giving_cc_details")
        nextPage = $.njDialerPlugin.getPage("Not Sure Giving CC");
    else if (donationQuery == "how_do_you_help")
        nextPage = $.njDialerPlugin.getPage("How Do You Help");
    else if (donationQuery == "how_different_from_other_charities")
        nextPage = $.njDialerPlugin.getPage("How Different");
    else if (donationQuery == "do_you_receive_gvmnt_support")
        nextPage = $.njDialerPlugin.getPage("Receive Gvmnt Support");
    else
        alert("Please select a customer query from one of the choices listed");
    
	return nextPage;


};

A more stream lined process that will hook a drop list to a matching wizard page having a page name same as the drop list value

$.njDialerPlugin.getPage('${NjWizardPageName}').onPageNext = function(page,defaultNextPage) {

	var nextPage = page;
    var donationQuery = $.njDialerPlugin.getFieldValue("DonationQuery");

	// Check if a value is selected in drop list
	if (donationQuery != "" )
	{
	    // Check if wizard page exist and set next page
		if ($.njDialerPlugin.getPage(donationQuery))
	        nextPage = $.njDialerPlugin.getPage(donationQuery);   
	}
	else
        alert("Please select customer query from one of the choices listed");
		
	return nextPage;
};