I have an OnChange Client script to redirect catalog item to a new URL when a field is not blank and restrict form submit. Currently its redirecting in the same page, but I want the URL to open in new tab and do not allow form to submit in portal.

jyotsna1
Giga Contributor

I have an On Change Client script to redirect catalog item to a new URL when a field is not blank and do not allow form submit. Currently its redirecting in the same page, but I want the URL to open in new tab and do not allow form to submit in portal.

Below is my On Change Client Script

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (newValue != ''){
var html = "Please click Ok to request aceess for the selected Application";
var c = this;
c.test = "OK";

if (html) {
spModal.open({
title: 'Message Alert' ,
message: html,
buttons: [
{label:'OK', primary: true}
],
}).then(function(test) {
top.window.location= (newValue); 

});
}

var redirectURL = 'newValue';
}

}

 

Could anyone help in getting this done! 

1 ACCEPTED SOLUTION

asifnoor
Kilo Patron

Hi,

Try like this.

var url = newValue;

top.window.open(newValue,"_blank");

Mark the comment as a correct answer and also helpful if this solves the problem.

View solution in original post

12 REPLIES 12

asifnoor
Kilo Patron

Hi,

Try like this.

var url = newValue;

top.window.open(newValue,"_blank");

Mark the comment as a correct answer and also helpful if this solves the problem.

Hi Asif,

Thanks for your response!

 

It worked to redirect page in new tab but its allowing form submit later which I don't want.

Link should open in new page and form submit should be aborted. Is it possible please?

Aha okay.

return false;

add this line after that redirection and check once. 

HI Asif,

Tried it, but did'nt work