spmodal confirm - How to change default button text ok/cancel

Ram102
Kilo Contributor

Experts,
I have a requirement to change the confirm default button text from (ok/Cancel) to (Submit/Attach) when submitting a record producer from Portal.
For Spmodal.open, we have the option to pass buttons parameter to show on the dialog, but I am not sure how we can pass it for spmodal.confirm.
Please let me know if you have any solution/workaround for this.

Thank you.

1 ACCEPTED SOLUTION

Hi,

Please use below code and check if it works for you.

Having your own widget to show as a popup gives you flexibility on what goes inside it.

Call g_user.showModalDialog - as per your requirement.

--> Write this in onLoad catalog client script
g_user.submitClicked = false;
g_user.showModalDialog = function(msg) {
		if(NOW.window) { //Service portal
			var shared = {};
			shared.message = msg;
			var popupOptions = {
				title: 'title_name',
				widget: 'id_of_the_widget_that_contains_what_should_be_there_in_popup',
				widgetInput: 'any inputs that need to be passed to the widget',
				shared: shared,
				footerStyle: {display:'none'}
			};

			if(! g_user.submitClicked) {
				g_user.submitClicked = true;
				var modalInstance = spModal.open(popupOptions).then(function() {
					g_form.submit();
				}, function() {
					g_user.submitClicked = false;
				});
			}
		} else {
			//Code to open popup in platform (you can use glide_confirm_standard)
		}
};

--> Write this in onSubmit catalog client script

if(g_user.submitClicked)
	return true;

return false;

View solution in original post

11 REPLIES 11

Pranav Bhagat
Kilo Sage

I dont think you can do that with spmodel.comfirm(it works like Javascript confirm).I would  say use spmodel.open.

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Pranav

Yes correct; confirm don't have more options/params. Try Open as below.

 

 

spModal.open({
	title: 'CONFIRM',
	message: $scope.data.msg_confirmation,
	buttons: [{label: 'Attach', value:2},
						{label: 'Submit', value:1, primary: true}
					 ]
}).then(function(response) {
	if (response && response.value == 1){
		$scope.doSubmit();
	}else if (response && response.value == 2){
		$scope.doAttach();
	}
},function(){
});

 

Chirag A

SNOW Dev

aavenir.com

Ram102
Kilo Contributor

Thank you. So to simulate the ok (complete submission), cancel(go back) do we know what code you add in dosubmit and doAttach?

Ram102
Kilo Contributor

Any suggestions?