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

Question

Question

Populate Checkbox options based on Database Lookup

asked on August 22, 2023

Hello!

I want to dynamically populate checkbox options based on the lookup for a database. For this form, the end user will enter a list of users in a prior form. After submitting, a workflow will add these users to the database. The end user will then be automatically rerouted to the second form in the process.

The form should look like this:

Users entered in previous form: Ted, Tim, Tom, Terry


Users entered in previous form: Jill, Jen, Jimmy, Jackson, John, J'avier

 

0 0

Answer

SELECTED ANSWER
replied on August 22, 2023
0 0
replied on August 23, 2023

Thank you! I will try this today.

1 0
replied on August 23, 2023

Good luck! My need was just a bit different than yours but I'm sure you can get it to do what you need. 

0 0
replied on August 24, 2023

Thank you! This worked - but how did you get it to retain the values? For mine, it's changed the labels but the values remain the same. 

1 0
replied on August 25, 2023

On the first form I saved the list to a multiline field and delimited it with '|'. Then on forms I used that multiline field's delimited list to fill in the labels.

 

So the first set of code on my last post in that thread is for the first form and the second set of code is for forms after that. 

0 0

Replies

You are not allowed to reply in this post.
replied on August 22, 2023 Show version history

I've used workflow or stored procedure to populate hidden literal values and then set the options using javascript.

function initRadioButtons() {
// initialize radio buttons from lookup literals for a copied request
    if ($('#q62 input').val() == "True") // Mandatory
      $('#q68 input[value="Yes"]').prop('checked', true).change()
    else
     $('#q68 input[value="No"]').prop('checked', true).change();
$(document).on("onloadlookupfinished", function() {
    // If this form is making a copy of a previous request then initialize radio buttons
    if ($('#q56 input').val() != "") initRadioButtons(); // Request Number

 

You are not allowed to follow up in this post.

Sign in to reply to this post.