This time the error's on me
An essential skill in life is the ability to laugh at yourself and to try not to take anything too seriously. This I find myself doing increasingly often. Only yesterday I found myself stood next to Karen, in a health spa, booking herself a facial-cleansing treatment/massage. Before I knew what I was doing I had asked the female receptionist "Do you do men?" and found myself booked in this afternoon for the full monty. Don't tell anyone will you!
Then I had to laugh at myself again this morning. Turns out the reason I couldn't get yesterday's server-side validation to correctly set the SaveOptions field was because I'd named it $SaveOptions by mistake.
So, the server-side validation is possible with some simple @Functions in the WebQuerySave event. As soon as I've got this month's out of the way I'll try and make this approach fool-proof and write it up as June's article. Thanks for all the feedback yesterday. Should come in handy when I get round to making the real thing.
There's a rudimentary example form here. You're welcome to try and break it...
Sorry, I just broke it... :-P
Woops. I forgot to test for " " entries in name. Fixed now. This isn't really what I meant by breaking it though. Forget what values are required and in what format, it's the principle of server-side validation that I want to test. There's no real way round it AFAIK.
Maybe its just me, but "Do you do men?" in a massage parlour could mean something completly different!!!
On the other hand, there is a program on Sky1 on Sunday that may interest you:
"How Gay Are You?
Sunday 30, 22:00, Sky One
Tongue-in-cheek series which asks heterosexual men - as well as their girlfriends or wives - questions about their pastimes and lifestyles to try to find out just how in touch they are with their gay side. "
Not that I'm suggesting anything!
A facial-cleansing massage....
Its official men are the new women...
I've seen the trailer for that program. Is there not a man having a facial and the words with the line of the song being "Face cream is just gayness in a jar"? You see, you have to laugh. I mean I have manly hobbies too. Like taking photos of flowers: {Link}
Going on holiday and the Mrs suggested I get spray-tan before we leave. I'll be standing in a paper thong later today whilst some bird laughs at my A4-white arse.
Well I didn't break it exactly, but you might want to put a maximum age in the age field or even calculate it from a ligitimate dob field?
If you hadn't had cucumber on your eyes you'd have spotted the $SaveOptions field 8)
Check your example...
Validations around age and country code is not proper.. not expected from Jake Howlett !!!
Thanks Sourav. I trim the country field as well now. As I said, it's rudimentary at this point. Whether or not the *actual* validation works or not is not the point really. What I am trying to prove is that you can do it server-side and, once it works properly, can't be UN-designed by a user with some JS know-how.
Lets home Karen doesn't see your blog, otherwise your in trouble.. ;-)
Why Pam? She was there. When I say "full monty" I'm not talking about anything rude.
The age field will ignore text after a number but will accept the entry. For example, i entered my age as "2 long" which was accepted. I'm not sure this could be considered as breaking it, but fyi.
Thanks Jon. Fixed that now. The age field is text and the validation simply checked @If(@IsError(@TextToNumber(Age));...
What this didn't do was any Input Translation. As well as the validation I needed to add @TextToNumber to the translation. Otherwise it just remains as the text you entered. @TextToNubmer doesn't return an error with things like "3 is the magic number 3". Instead it simply returns 3.
From reading the comments, it appears that you (Jake) have set the standards too high. :-)
You mentioned that this was a "rudimentary" example, but we are still questioning your validations.
Looking at that, all I can say is.... Jake, keep up the great work!
Well I didn't break it, but I managed to put the validation form out of business, by entering |SCRIPT|document.forms[0].style.display='none'|/SCRIPT|
Sorry.
Yeah, thanks David. I wanted you to test it, not hack it ;o)