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

Question

Question

Global variable across multiple form uses

asked on June 23, 2014 Show version history

 Hello,

I'm wondering if its possible to use a variable that will decrease by one each time the form is ran until it is 0. I've tried a few things but it will always just reset back each time the form is ran.

 

Thanks!

0 0

Answer

SELECTED ANSWER
replied on June 24, 2014 Show version history

Right, you need to keep the total number of prizes somewhere that each instance can access. If you do the calculation only on the client-side using JavaScript, you can't update the total where other instances will have access to it.

0 0

Replies

replied on June 23, 2014

I was just curious but what's the use case here? Are you just trying to limit the # of forms that can be submitted? There may be another way to get the same result if you could explain a little bit more about what you're trying to do here. 

0 0
replied on June 23, 2014

Okay here's the situation,

Random people will be submitting a form through the portal. Each time they submit a form they are awarded a prize which will show up at the bottom of the form after they have filled in their information. I wanted to have a variable with the actual number of prizes that can be given away set at the beggining. That way each time someone submits a form, the total number decreases and as soon as it hits 0, it will no longer show the image. I have several pictures that will just show up at random, so there will actually be more than one variable I will need to set, but I was just trying to see if it was even possible.

0 0
replied on June 24, 2014

Use a database table, store the original number.

 

When load form, setup a database lookup rule, read the number(s); setup a page rule, if number bigger than 0, or other criteria, show the certain html field with certain image.

 

After user submit, add a workflow service task, deduct one from the original number.

0 0
replied on June 24, 2014

So this is not possible without access to a database?

0 0
SELECTED ANSWER
replied on June 24, 2014 Show version history

Right, you need to keep the total number of prizes somewhere that each instance can access. If you do the calculation only on the client-side using JavaScript, you can't update the total where other instances will have access to it.

0 0
replied on June 24, 2014

Thanks guys, I was really hoping there was some other way to do it without using a database but I guess not!

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

Sign in to reply to this post.