List Select – Individual Link Confirmation

When building a ListSelect component, I’ve found on occasion that one or two outcome links in the ListSelect should have its own, personalized confirmation prompt.  A configuration option isn’t available to handle this, so one will have to be created.

This can be done in several ways.  If you’re using image links such as is detailed in another of my posts, you can key off the “alt” attribute set in the Outcome’s Text field.  If you’re using the normal text outcomes, you can reference the innerHTML value, or, if you are innerHTML-phobic, add a wrapper to it and key off of that; adding a simple span tag works, as does a font tag.

For the purposes of this article, I’ll use innerHTML and also show how to alternately use a span tag.

Open the configuration window for the ListSelect component and add/edit the outcomes for the component.  Classically, adding an outcome path name of “Delete” will be accompanied by the text “Delete”.  Add a “Delete” outcome with standard “Delete” text, as well as a “Remove” outcome.  We will be calling the “Delete” link by innerHTML and the “Remove” outcome by an added span wrapper, like this:

<span title="removelink">Remove</span>
Symantec Workflow List Select Component
For the purposes of this article, the List Select outcomes are configured like this.

Now, let’s add a “Link Custom Event”.

2014-10-28_11-14-06
Now we’ll also need to account for the “Remove” outcome.  I’ll note as well that variables can be used in the return confirm text to provide context around the event inside the confirmation prompt.

The full javascript:

if (this.innerHTML == 'Delete') {
return (confirm('Do you really want to Delete this item?'));
}
if (this.firstElementChild.title == 'removelink') {
return (confirm('Do you really want to Remove this item?'));
}

Using this process, you should be able to configure a ListSelect component to return separate messages depending on the link clicked.

compatible_ie2020compatible_firefox2020compatible_chrome2020compatible_safari2020compatible_opera2020

One thought on “List Select – Individual Link Confirmation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s