Random Value Generator widget: Ability to define range is requested

  • matheg
    Asked on May 21, 2021 at 9:10 AM

    Hi! I have a quite complex form (a test), where I have a lot of questions, but I want to show only some randomly selected of them.
    This is my original form: https://eu.jotform.com/build/211111048244339

    Everything works fine until I reopen the form for editing the responses.
    In this case, the random numbers are generated again, and I don't see the original questions anymore. (I think, the same thing would happen if I would enable Continue Form Later.)So I made an experiment (see link below) and I tried to generate the random number based on a condition (the field is empty). But it doesn't work. I have no idea, why... After this, I tried to use two fields, but it didn't help.

    So at the moment, I couldn't check at all, whether my original goal would work or not.

    Any suggestions?

    Anyway, if I open the form for editing the responses, my hidden fields also appear, but this is another problem...

    Best regards, Gábor

  • Bojan Support Team Lead
    Replied on May 21, 2021 at 9:50 AM

    Greetings Gábor.

    One of the solutions would be to add a second text field to your form where you copy the random value only if the form URL doesn't contain the word Edit. To achieve this, you will need to add the Get Form Page URL widget.

    Then, you can copy the value using the conditional logic in the following way:

    screenshot 5656 Screenshot 10

    This way, if you open the edit submission from the link or from the Inbox the random value won't be copied, and you will get the same number.

    Have in mind that you also update the Submission directly from the Tables, by double-clicking the value you wish to modify.

    Let us know if you have any additional questions.

  • matheg
    Replied on May 21, 2021 at 10:05 AM

    Thank you for your quick response. I'll give it a try...

    But regardless of my original problem (editing the responses), why don't my conditions working properly?

  • matheg
    Replied on May 21, 2021 at 10:30 AM

    well, I gave it a try...

    I open the response from the table. and the suggested solution doesn't work, since the URL doesn't contain the word "edit". But surprisingly my original conditions started to word. I can't follow the happenings... :)


    1621607277 60a7c36d65fcd  Screenshot 10

    Random Number 2 contains the ORIGINAL random value, which was 7. :)

    1621607636 60a7c4d40a13e  Screenshot 21

  • Patrick_R
    Replied on May 21, 2021 at 12:28 PM

    Hi Gábor! In your form the random number is being calculated the first time the form loads; it then gets re-calculated in the 'edit' mode too; which I believe you do not want. As far as I understand, this random number should only be generated once and must be retained in 'edit' modes (including in 'Table' and 'Inbox' view).

    Instead of form calculation; if you just use a condition to calculate this random number for the field 'Random Generator'; that will ensure that you don't save a different random number every time you open and submit the form in 'edit' mode.

    Also, if this random number is only generated once; this will ensure that only those fields which the user originally saw and filled are visible in the edit mode to you as well.

    So, looking at your form setup, if you include the word 'table' and 'inbox' in your condition as well (screenshot attached for your reference); that should ensure that the random values are not being re-generated in these views as well.

    1621614403 60a7df4371cbf The Easiest Onl Screenshot 10

    This is a simple form that I created for testing purposes: https://www.jotform.com/build/211404363804043

    You can clone it into your account and test it in edit mode; table view and inbox view. This form will retain the generated random value in all edit modes.

    I hope this helps. Let us know if you have any questions or if this doesn't help.

    Thank you!

  • matheg
    Replied on May 21, 2021 at 1:42 PM

    Patrick, this is great!. almost perfect! Thank you!

    The only case when it sucks if I enable Save and Continue later.
    I guess I have to add one more condition with "doesn't contain" ... but doesn't contain what? Which string should I use for covering the case continuing the saved form later?

  • Amin_N
    Replied on May 21, 2021 at 3:55 PM

    Hi again,

    When the user is back continuing the form from where he/she left off, the link he uses is on this format:

    https://form.jotform.com/000000000000000?session=00000000000&stoken=00000000

    So, the keyword what I would like to recommend using here is "session".

    Should you have any further inquiries, we will be more than happy to help.

  • matheg
    Replied on May 21, 2021 at 10:13 PM

    unfortunately the random number is shown blank in this case... (it should be 10, in my experiment)

    1621649586 60a868b284701  Screenshot 10

  • Patrick_R
    Replied on May 22, 2021 at 2:47 AM

    Hello! It seems that the 'save & continue' functionality works differently compared to 'edit' functionality. It is working as expected in this case too but it is not solving our purpose of retaining the value in this 'save' mode.

    So, as you only want a random number that should retain its value in 'edit' modes and 'save' mode; you can simply use the 'Random Value Generator' widget instead. This doesn't need any condition for retaining its value; it will only calculate the random number once and will retain in from that point onwards.

    Here is a form that I prepared: https://form.jotform.com/211411416588049

    You can clone this into your account and test it.

    Let us know if you come across any issues.

    Thank you!

  • matheg
    Replied on May 22, 2021 at 4:08 AM

    Oh yes, I know this widget. I've made already some trials with it. But my problem is, that I can't define a range for numeric values.

    Actually, I work on an exam test for my university students. To make cooperation hard for them, I made variants of questions (sometimes there are only 2, sometimes 12), and I use conditions based on a random integer to show one of the question variants and hide all the others. Using the formula round(random*11) it was easy to generate an integer between 0-11. And round(random) was just perfect for the range 0-1. If the Random Value Generator would have this option, it would be perfect for my purposes.

    Anyway, the case with save/continue later was just a theoretical question, since during my tests this option is not allowed for my students, so I will use the first method with the Get URL widget and the appropriate conditions.

    Sorry for causing so much trouble to you with this topic, but this is essential to me. Besides teaching Jotform (I have a course on online surveys too) I want to profit as much from Jotform as possible.

    One day it would be a great development for Jotform to add quizzes, but in a professional way (with question bank, randomizing, partial scoring, etc.). I have a lot of ideas!

    I want to say thank you to all of your supporters. I've never met such a professional, friendly, and helpful team before!!!

  • Patrick_R
    Replied on May 22, 2021 at 6:05 AM

    Hello! We're glad to help. I've also escalated your suggestion as a feature request, i.e. the ability to define range for the 'Random Value Generator' widget.

    If this gets implemented; we'll let you know via an email under this thread.

    Also, I'll answer to your quizzes related query here: https://www.jotform.com/answers/3114475

    Thank you!