What's the best way to handle data validation as entries are made?

I’ve got an app where users can collect items they’ve ordered from a venue.
My issue is that I want to stop people being able to collect more things than they’ve actually paid for.
So I present them with how many things they’ve got available to collect and an input box to say how many they want.
They then click “Redeem” to start the Collect Process
It looks like this.

Screenshot redeem

Thing is, I don’t want the “Redeem” button to be clickable if
The User is collecting more than is available OR if they haven’t entered an amount to collect (because that sends a pointless request for nothing!)

So, I’ve added a condition to make the Redeem button “Unclickable” if the Collect Amount > Available Amount or if the total of what’s being Redeemed is zero. That seems to work but the button doesn’t become clickable again if the amounts are corrected and even after I’ve put in a second condition to say “If Available > Being Collected” This button is clickable.

I’d love to put a link to the editor but I’ve been asked to keep it confidential for now.

If the above makes sense, what would you do to resolve the logic? The logic seems to be simple but it escapes me so I’ve ended up just compounding the issue by creating more and more conditions that confused the heck out of me so I’ve now deleted them all.

Thanks in advance for any assistance!

Hi there, @joefarrowsmith… if I was in the situation you described, I would get rid of all of the conditions and start over (which it sounds like you have done). I would make the button not clickable by default, and I would add a condition that says something like when available is greater than or equal to collect now and collect now is greater than zero, make the button clickable. Have you already tried that condition?

Oh, and I would likely put a similar condition on the workflow event associated with the button so it can’t run if a user tries to collect more than the available quantity.


Hi Mike
I think you’re right. I’ve got rid of all the conditions and wondered about doing what you describe so it’s really good to have confirmation that it’s a sensible route. I wasn’t sure if it was basically the same thing but I like the simplicity of it and my brain is basically soup after staring at this for days (which also means it took a lot of courage to delete all the conditions that took me so long even though they were rubbish!)
But yeah, there seem to be fewer times when the button should be clickable rather than when it shouldn’t so it makes perfect sense just to specify when it’s clickable.
Awesome. Beer O’Clock too so I’m finishing on a high today thanks to you!
Have a wonderful rest of your day.

1 Like