Hey all,
I'm struggling with, what i think to be, a fairly simple problem.
I have a text field and i want to make sure that the user doesn't input a number below 500 or above 2000, but i just can't get the validation to work. I've tried various approaches and ways of doing it, from reading around on google and the forums. But none of them seem to work for me.
What is the easiest way of achieving this validation?
Hey GreyHead,
Thank you for your quick reply!
I've tried adding the code you mentioned, but without luck. Something got me wondering though, you mentioned the HTML (Render form) action in the Submit event. I don't have this action in my submit event, is that needed? My thought is that it just displays/renders the form after hitting submit, which i don't really need.
I've attached a screenshot of my setup page for reference
I forgot to add that with the code added, the form just submits with no objection even if i input a number outside the 500-2000 range.
HI Meisner,
Apologies - must be Monday morning :-( The Load JavaScript action needs to go in the On Load event.
Bob
I was -so- close to just doing that, cause of your mention of the html render, but ending up going "Nah, he's a pro, just do what he says"😀
That works like a charm, thanks! Can i add a custom validation popup, as it right now just says something along the lines of "Please check one of the fields/options". Could i add a bit of code to the JS to make it go "Amount has to be between 500 and 2000" instead.
Hi Meisner,
Add it to the title attribute of the input element - that will over-ride the default message.
Bob
Thank you for all the help GreyHead, amazing support. Quick responses and so on point! Really appreciate it