Can you use this: https://formidableforms.com/knowledgebase/general-form-settings/#kb-submit-button-logic
You'll have a hidden field with a default value that counts the total of the quantity field like this: [frm-stats id=x type=total 25="completed"]
Maybe you have "hide" if quantity total (hidden field) is greater than 99
Thanks @Bobby Clapp but not sure I follow. How would that check say 4 previous entries for how many tickets were purchased? Can you increment and store a value as entries come in and then check against that stored value for each form submission?
The frm-stats shortcode is going to total the values entered for the field across the board.
Sorry, I am still a little lost here, let me see if I can talk this out here to make sense of what you are saying...
1. Create a hidden field: total_tickets_sold
2. Add the frm_stats shortcode to the form itself(?)
3. Add conditional logic to the submit button: "Disable when > 99"
Btw, this would've been the more helpful link to see all of the parameters of the frm_stats shortcode
https://formidableforms.com/knowledgebase/add-field-totals-and-statistics/
Thanks
Plug that shortcode into the hidden field. It will carry a running total. Then it's always checked against on every new entry based on the new condition. The link would have been helpful, yes.
I think I am still confused about this part of the shortcode: 25="completed"
25 is the field that holds the status value. 25 is the field ID of that field. In this way you are totaling the value of one field where another field, 25 here, has a particular value.
Again, still confused as to what you mean. Here is my shortcode:
[frm-stats id=ticket_qty type=total total_tickets_purchased="completed"]
ticket_qty = The ID of the field where people select how many tickets they want to purchase
total_tickets_purchased = The ID of the hidden field this shortcode is placed
What am I missing here?
Seems right. Not sure if it takes field keys if that is what you are using, but it probably does.
Test run it. Sometimes seeing is believing. 🙂
I have and it is not storing any type of value.
Shouldn't I use the following maybe?
total_tickets_purchased_less_than_or_equal_to="100"
That didn't work either, I tried shortening it to just:
[frm-stats id=ticket_qty type=total]
No value is being saved here.
There might be something with the paypal addon. Can you create a test form without a paypal action?
Nevermind, shortening it to just the above-mentioned shortcode is saving the values now. However, it doesn't display that in the Entry Viewer until a new entry is created, so it looks confusing:
https://i.imgur.com/7MdmTzR.png
Checked the hidden field on the front end and the total is showing for total_tickets_purchased = 40
That is correct process. Now we just need to ensure that once 100 is reached, the submit goes away as desired. You may need to bring back in the status into the shortcode, otherwise everything will be totaled. That may be okay as you have some on reserve but awaiting payment approval. That's all in your court though.
I do have a conditional on the Submit button that if total_tickets_purchased is Greater or Equal To 100 - disable the button
However, I had 4 entries already with a total of 40 tickets purchased, I submitted the form one more time buying 65 tickets - it allowed me to do so, thus putting the total at 105 tickets sold - which cannot go beyond that 100 ticket limit.
It is disabling the button when I go back to the form though. Almost there.
Yep. So we now need to calculate the remaining amount of tickets available. Add a new field (read-only) that subtracts the previous total from 100 via field calculation. This will be visible to the user to show how many tickets remain. Now only show the submit if the tickets that remain is less than or equal to the [frm-stats id=ticket_remain type=total]
I think it will work like that. Hard with me not seeing it.
I will give this a go and report back. I appreciate the help!
I am still having issue with this form. Here is the link to the form:
https://theikefoundation.org/2022-hobie-kayak-raffle/
I disabled the PayPal action on the form and all submissions come to me.
Its properly showing the "Remaining Tickets" and I have the submit button enabled like so:
Remaining Tickets - Greater than or equal to - 0
Remaining Tickets - Less than or equal to - 100
The issue is that it doesn't prevent someone from buying more than the total allowed tickets - which is 100. If I submit the form and buy 50, then refresh the form and buy 55, it allows it to go through, and then it says -5. I need to prevent someone from buying more than the Remaining Tickets.
Let's try some jquery to help here. In the customize HTML, add the linked code into the "after fields" box.
For some reason, the "Default Value" for #field_tickets_remaining is not being passed initially, the value is showing as empty - even though there is a calculation there for that field: 100 - [fieldID] which should pass 100 since the fieldID's value at first is zero.
Send me an email with the appropriate info to get in and poke around if you're willing to do that. [email protected].
I just sent you an email with login info for the site. Thank you for looking into this, it is greatly appreciated!
Please login or Register to submit your answer