How to preselect an option of checkbox randomly?

  • nhamwey
    Asked on March 30, 2018 at 11:57 AM

    I am trying to have random options selected when the form opens/submitted.

    I can use the Random Value Generator, then assign numbers to my options with conditions that are then displayed in another field.

    example:

    0 = red
    1 = green
    2 = blue
    etc.

    The problem with this is Random Value Generator allows for you to select the # of digits, so 0-9 means id only have 10 options, and 11-99 means I would have to assign too many conditions and duplicate numbers for some.

    Is there another work around that anyone knows of? I was hoping the checkbox and/or button widget would allow for a random preselected option, but that isn't the case.

    Thanks

  • Victoria_K
    Replied on March 30, 2018 at 1:06 PM

    Unfortunately, to select an option at checkbox with condition, you need to paste it as a string (an actual value of checkbox option, not calculated). So, I can't see the way to avoid a variety of conditional statements. 

    But, you can shuffle options of a checkbox to display them in random order, isn't it acceptable?

    1522429545screenshotwg68f Screenshot 10

    Let us know if you need further assistance.

  • nhamwey
    Replied on March 30, 2018 at 1:24 PM

    Im not sure what a string is or how to paste it.


    But, are you saying that I can make the 1st checkbox selected and then randomize the options to make a random selection?


    Everything I am trying to achieve is done in the background. The user will make no selections and their randomized selections will appear after submitting the form.

  • BJoanna
    Replied on March 30, 2018 at 1:57 PM

    You can pass the string to checkbox field with conditional logic like this. 

    1522432124calcualte Screenshot 10

    How to Insert Text or Calculation into a Field Using Conditional Logic

    Here is my demo form where checkbox option will be randomly selected. 

    https://form.jotform.com/80885624840969 

    Feel free to test it and clone it

    I used Random Value Generator widget as you did in this form http://www.jotform.us/form/80835410361147 

    But, are you saying that I can make the 1st checkbox selected and then randomize the options to make a random selection?

    This is not possible. If you pre-selected an option the same option will always be selected even if the options are shuffled.