Me and a coworker have been banging our heads against this for a couple of days, should have asked sooner!
We have a Form that acts as a task tracker and is initiated by Workflow. Workflow pre-populates a table with the list of tasks the user is to complete. SOME of these tasks have a URL associated with them. Rather than having a column of ugly URL's, what we've been trying to accomplish is attaching the URL to the name of the task, such that the task name becomes a hyperlink.
Thus far, we have had some success conditionally creating the HTML in Workflow, such that the value of the task name is driven by this token:
<a href="%(Task URL#[%(ForEachTask_Iteration)]#)" target="_blank" class="taskURL">%(ForEachTask_Current Value)</a>
In this example, "ForEachTask_Current Value" is the name of the token, and "Task URL" is of course the URL. We use the following javascript to utilize the HTML code rather than just displaying it:
$('.taskTable .taskName').not(':first-child').each(function(index,element){ var display = $(this).find('input').val(); //$(this).find('input').hide(); //debugger; $(element).before($(display)); alert(display); });
This causes some odd formatting (eg, table values that are higher than they should be, and having to make sure the column takes up the full table width because otherwise the html code shows to the right of the hyperlink). It does more or less work, but we've discovered that any tasks with special characters (such as an apostrophe) break the loop, and the code fails to execute for any subsequent values.
We did try using "replaceWith" instead of ".before" but for some reason that completely dropped any value that didn't have an associated hyperlink.
I'm thinking there MUST be an easier way to accomplish this. Can anyone help?
Using Forms 10.4.1
EDIT: Here's a screenshot of what we're trying to accomplish. Note the slightly raised "Task Name" value for hyperlinks and the fact that the apostrophe in "Driver's Training" broke it: