Just a quick thought. In Chapter 7 (I don’t have the book in front of me right now) where the book talks about the calendars and how to set them up. There is a paragraph talking about how you can’t stop a customer from putting in the date manually. I’m writing to point out that actually you can stop them. Make the input area readonly. To ensure that the color doesn’t change to the off grey color some browsers change a readonly area to - change that color to black. Now the user can’t muck up the calendar entry and they have to use the calendars.
Then you put the readonly stuff into the Javascript too. Or rather - into the jQuery too.
While it is true you can’t prevent someone from turning off Javascript and letting them muck up something like a date, it is also true that if you are going to use jQuery you should ensure that - if Javascript is operational - that you can force the user to put in a date correctly. Or at least correct in your methodology. PHP, on the other end, has a function called strtotime() that can convert almost any date/time into a unix timestamp which you can then get the date out of. So even if the user does muck up your date string, PHP should be able to sort it out and if not - that is what error messages are for.
If you make it readonly in the HTML, then only users with Javascript can fill in any date at all.
Savvier users can pretty much change anything with access to a text editor. Dunno if the book was talking about them.
I personally like the idea of Postel’s law when it comes to dates. So long as it’s not retardedly ambiguous, let the user put in any number of (good enough for your system) date formats and let the back-end transform to what your DB needs, as you said with PHP.
Best usability : ) Plus then you’re not forcing people into an obnoxious date picker (I keyboard through forms but even though for example Opera’s HTML5 date input type works with keyboard, the popping-up of a graphical calendar makes me reach for the mouse… then I stupidly try to click on these tiny little day buttons. Aaaaaaah!).
I figure if I do this type of retardosity, moms who use mice to fill in forms do too. I like graphical date pickers as a friendly option for people who really need to see calendars to choose dates (but still allow a plain-text input for the rest of us).
What’s nice about using Javascript rather than HTML5 for this is, with Javascript you can build both and have your own error messages for exactly the date format you want etc. HTML5 is supposed to localise but that’s to the user’s browser, which may not be the browser owned by the user (hotel computers in foreign countries yay!).
I did get this Novice->Ninja book in anticipation of needing to make a big switch from vanilla JS to jQuery, but then that site got taken down But it looks like I’ll be needing it soon anyways. It seemed a decent book when I flipped through it.
I, personally, do not use jQuery. I got the book because the company I work for talked about using jQuery. However, we have people who have IE 5.5 and jQuery is dropping it (1st reason) and I already have my own library of Javascript that I use. My library is, with comments, about 3KB in size which makes it less than jQuery’s size and there are just a few routines I call for everything. I like jQuery’s ability to do a huge number of things but until the medical world catches up with everyone else - I have to use my own stuff.
Interestingly, my full library which I have at home (and which I have GPL’d though I haven’t released it yet) uses 90% my own stuff and 10% other people’s stuff in that I looked at what these other people have done, given them credit in my own libraries, modifed most (if not all) of the routines so they take more things into account, and put them in to my libraries. I decided to do a smart technology type of thing. What I mean is - I have a stack built into the PHP code which makes it so you can not duplicate a routine. You can call it or try to load it as many times as you’d like to do so but the library will only allow one copy of each routine into your code thus reducing the overall size of the Javascript. (Not to mention errors from trying to load the same routine from two different places.) Then I made each routine, if it needed to call a different routine, automatically include it into the stack. By doing this I can, in some instances, only include one function and it builds the rest of the list of routines for me. Also, my library allows me to either have the javascript included into the webpage itself or placed into a temporary file and then loaded into the program in that manner. This last option allows me to go all the way back to Netscape v3.0 (which, when javascript was loaded from an external file, would wipe out any other javascript that was already loaded). I’m working on making the library so it tests all of the incoming information to the server so it can alter itself as need be in a dependent manner so depending upon what is or is not available it adjusts itself accordingly. I’m also working on a speedometer. Not a graphic odometer, but a way to test the speed of the incoming request which I will need for a game I am also working on. I need to be able to sync the incoming calls so everyone in the game is updated at the same time (or as close to that as possible). I want to do it in javascript rather than writing a client/server in C (or using a pre-existing client/server). Some of my javascript is highly re-entrant and recursive and, like jQuery, makes use of the settimeout() function to start and stop various things. However, I am not ready for prime time yet and my site is littered with dead test cases. As I am sure anyone who writes code has.
Later!
I’m also working on a speedometer. Not a graphic odometer, but a way to test the speed of the incoming request which I will need for a game I am also working on.
Oh, like a steam-powered internets pressure gauge http://handley.org.uk/fzz/?p=63
And, anyone who says “Oh jQuery’s not that big” is just being silly. There’s always versions of it like jQuip.
No - I mean - everyone has a different connection to the internet. So I want my game to sync between them. This is mainly a strategy game so moves are every X number of minutes. So it isn’t real time. This is mainly because you can command large groups and it takes time to send all of those commands out to the various members of your command. I’m trying to sync everything together so my computer sends out commands once every X minutes and I need to make sure everyone is on the same turn. What I’m trying to prevent is one person jumping in after someone has killed a monster and taking the treasure. By syncing the turns I can give precedence to whoever killed the monster so they move before the other person does.
Whoever said “Oh jQuery’s not that big”? In usage it’s either #1 or #2 around the world. Size-wise it is approximately 15K. (Unless you use the UI which is 235K I believe?) The reason I wrote my own library was because there just wasn’t any kind of thing like jQuery when I started my own library. (Think Netscape v3.0 - I was working at NASA at the time when that came out.) I also have friends who live in the country that only have dial-up. Some of them still have Windows v3.1. It works for them so they use it. I know - very old technology. So I use my library because it works all the way back to Netscape v3.0.
Now - do I have anything that makes PNG work all the way back to Netscape v3.0? Of course not. My libraries are to get the basics done so you can generate tables easily, do lists, and the like. As things came along I added to it. Originally I used Perl like everyone else and C/C++ and only in the last six or seven years have I switched to PHP. (Which was a real pain because of all of the re-writing I had to do.) And I’m not trying to say my library is better than jQuery as a whole. Far from it. For >MY< purposes it is. But I don’t do AJAX a lot so my AJAX stuff is just enough to get what I need done whereas jQuery has a whole slue of things it can do with AJAX. And I wrote my own SPRINTF function in javascript so I could easily convert data, and I did other things like that. But I’m just a minimalist at heart so I only have things that I need in my library. Which is why I put in the redundancy checks, the stacks, and other things like that. It keeps the output to a minimum. Or - as small as I can get it.
No - I mean - everyone has a different connection to the internet. So I want my game to sync between them. This is mainly a strategy game so moves are every X number of minutes. So it isn’t real time.
Ah! Neat. There was a game they made which is hosted in America where you are able to watch other players play games in real time and we were pretty awed that it was as fast as it was. We never heard how they did that. We suspected the likes of voodoo.
Whoever said “Oh jQuery’s not that big”?
Oh, people in general. I didn’t mean you. I should have said “Those who say”. I find that a lot of people download a lot of jQuery to do pretty simple things, and I wonder why the heck they bother. Stuff like hide and show kind of things.
The reason I wrote my own library was because there just wasn’t any kind of thing like jQuery when I started my own library.
As you said, a lot of developers have their own library for this reason. I have my own because a) I’m not good enough to write all the event handling basics that work in IE on my own anyway, and b) I like that that’s kinda all it does (deal with events and “this”). So I know that it doesn’t do a lot of other things that I’m probably not using it for anyway, whereas with jQuery (or any of the other popular ones out there), there’s a whole lot of code there to do things I’m not doing.
I also have friends who live in the country that only have dial-up. Some of them still have Windows v3.1. It works for them so they use it. I know - very old technology.
The current generation of developers seems to have forgotten these people exist. Or assume they don’t use the internets.
Originally I used Perl like everyone else and C/C++ and only in the last six or seven years have I switched to PHP. (Which was a real pain because of all of the re-writing I had to do.)
Have you looked back at Perl at all? It’s awesome what’s going on in Perl today. For the C stuff there’s XS, though I dunno if working with XS is a pain in the butt or not.
But I don’t do AJAX a lot so my AJAX stuff is just enough to get what I need done whereas jQuery has a whole slue of things it can do with AJAX.
That’s exactly the issue with jQuery (and the likes): they’re build to deal with anything some dev may want to do, meaning there’s usually a big bunch of code in the library not even getting used, yet users have to load it.
Using your own library where it does only what you need ++
Or - as small as I can get it.
Users thank you for pages that don’t take days to load. I remember dial-up just fine. And Netscape. Hoo, I can’t imagine trying to open any popular page using that today. Last time I looked at the Video for everybody page, it was dedicated to helping a friend of his get a better than 32bps connection or something.