The CreatorCon Call for Content is officially open! Get started here.

Order Guide disable "Next" button

booher04
Tera Guru

I'm trying to disable the "Next" button(grey out) if the logged in user has a specific role.  The need is to hide fields and display a link to an external page if the user has a certain role.

 

I have the fields hidden and link displaying correctly but I can't get the next button to disable correctly.  It disables(greys out) for anyone not just the user with the role I created.

 

Here is the UI Policy I am using to hide/display variables if user does not have the role:

 

function onCondition() {
var Userx = g_user.hasRoleExactly('fnf_virtual_machine_no_redirect');
        if (Userx.toString() == 'false' ) {
	
		g_form.setDisplay('label_ewr', true);
		g_form.setValue('cb_redirect', 'true');
        g_form.setVisible('sql_cluster', false);
		g_form.setMandatory('deployment_location', false);
		g_form.setVisible('deployment_location', false);
}

}

 

 

I tried the below in a client script to run onLoad and I also tried adding in the code above and it did not work: 

this.jQuery('#submit').prop('disabled', true);
 

 

function onLoad() {
var Userx = g_user.hasRoleExactly('fnf_virtual_machine_no_redirect');
        if (Userx.toString() == 'false' ){
   setTimeout(function() {
        this.jQuery('#submit').prop('disabled', true);
    }, 2000);
}
}

 

 

1 ACCEPTED SOLUTION

booher04
Tera Guru

I was able to achieve what I needed by creating an onLoad catalog client script on the order guide:  I had to put in a timeout function in order to get it to work correctly

function onLoad() {
var Userx = g_user.hasRoleExactly('fnf_virtual_machine_no_redirect');
        if (Userx.toString() == 'false' ){
   setTimeout(function() {
        this.jQuery('#submit').prop('disabled', true);
    }, 2000);
} else var Userx = g_user.hasRoleExactly('fnf_virtual_machine_no_redirect');
        if (Userx.toString() == 'true' ){
   setTimeout(function() {
        this.jQuery('#submit').prop('disabled', false);
    }, 2000);
}}

 

View solution in original post

5 REPLIES 5

booher04
Tera Guru

I was able to achieve what I needed by creating an onLoad catalog client script on the order guide:  I had to put in a timeout function in order to get it to work correctly

function onLoad() {
var Userx = g_user.hasRoleExactly('fnf_virtual_machine_no_redirect');
        if (Userx.toString() == 'false' ){
   setTimeout(function() {
        this.jQuery('#submit').prop('disabled', true);
    }, 2000);
} else var Userx = g_user.hasRoleExactly('fnf_virtual_machine_no_redirect');
        if (Userx.toString() == 'true' ){
   setTimeout(function() {
        this.jQuery('#submit').prop('disabled', false);
    }, 2000);
}}