You are viewing limited content. For full access, please sign in.

Question

Question

Create a bulleted list within Forms from a table field

asked on July 27, 2022

Hello all,

I've searched and searched and feel like I was getting warmer, but couldn't quite figure this out.

I have a form that has a table (with one column) in order to collect multiple selections. At the end of the process, I am tidying things up by using a Custom HTML field to have more flexibility with the appearance of the saved form. When I just directly relate the table variable to the Custom HTML field, I get the "Item1; Item2; Item3" formatting. I would love to get it bulleted, such as:

  • Item1
  • Item2
  • Item3

 

I've built a workflow with a for each loop (from the table) and and tried splitting the tokens, but it's not working for me. I also have the workflow sending that new token to a separated Multi-Line field back in forms. And then relate that Multi-Line field's variable in my Custom HTML.

Not sure if I am just digging myself in a hole or if I am missing something really easy, looking for some advice.

I thank you all in advance.

0 0

Replies

replied on July 27, 2022

There's probably a million different ways to do this, but the issue you're always going to have is that in order to get a bulleted list, you usually need HTML and referencing a variable is always going to give you literal text so I think JavaScript is really the best option to get what you want.

Based on what you described, I'd skip the entire workflow/extra field approach and just run your JavaScript directly on the source table (i.e., keep the table on the final form, but hide it and select Save the data, make it read-only, etc., so nothing gets lost).

On that final form, add a custom class to your column field (not the table).

For the sake of the example we will call it "myItem" but you can name it however you like

Then, add a <ul> element to your custom html with an id attribute like "myList"

For example,

<ul id="myList"></ul>

Then, add the following code to your form

$(document).ready(function(){
  // clear list (may not be necessary)
  $('#myList').empty();

  $('.myItem input:not([type=hidden])').each(function(){
    // add list item
    $('#myList').append('<li>' + $(this).val() + '</li>');
  });
});

Now keep in mind, things get more complicated if you want this to work for a saved copy or when looking at the form in the monitoring history because the input elements no longer exist, but if all you care about is showing it that way on the final form in the user task this will do the job.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.