Redirection -Alert

Angel27
Tera Contributor

Hi , 

As I want to show the alert in the form (currently not in use ) & need to mention the URL also in that alert message , so that user can click on that link while showing the alert .

But in alert we could not mention link .

Is there any possible way anyone could suggest .

Thank you !

6 REPLIES 6

Tom23
Tera Expert

Hi Angel,

There's a few options here, based on your exact requirements. Is this on the portal, or on an in-platform client script?

Either way, I don't think it's possible to insert a clickable link into a javascript alert function. If it's an in platform client script, then I'd use confirm to redirect to the link you want to go to. The exact method would depend on if it's an external or internal link you want to use.

If it's a portal script, you would be able to use a modal, should you wish. This gives you greater scope and options and it would be possible to include a clickable link.

 

Angel27
Tera Contributor

Yes, it's a portal script.

Could you please suggest the script on the same.

Sure. Here's an example of a modal script with a url redirect option. Obviously you can add more information as you wish.

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    var url = 'Click <a href = "https://www.google.com">here</a> to be redirected';
    spModal.open({
        message: url,
		title: 'URL redirect Modal'
    });

}

The key bit is the spModal.open({}); syntax.

Adding a screenshot:

find_real_file.png

Clicking on the here redirects to the given url

Angel27
Tera Contributor

As , I don't want  the cancel option.

Just will be requiring ok button only .

Is there any way for that ?