Looking Under The Hood

Looking Under The Hood

I realised today, somewhat belatedly, that our shiny Toyota Verso is due for its first service (the service interval is shorter than on my previous car, which caught me out).

So, I'm trying to book my service online for this Friday afternoon, using Toyota's glossy and professional-looking UK website. But every time I try to progress onto the second screen, I'm thwarted by this message:

Now this strikes me as a little bit odd, as Friday 12th is clearly between 2 and 90 days from today.

I decide to go spelunking around in the source, and quickly find this gem within a JavaScript function entitled "checkDate":

Ouchy. So the date range check has been done in two steps, rather than using an or operator, and the message text differs between each step. The nextAvailableDay variable is correctly being set to five days hence, but the message is incorrect in this case. I was going to cite cut-and-paste coding but then I noticed the mis-spelling of "Centre" in the first message so now I'm not sure.

Just for fun, I tried circumventing the client-side validation by entering javascript:document.forms[0].submit(); in my browser's address bar, and that got me through to the next step of the process just fine (no server-side validation, then). But I stopped short of going through with the online service booking - I'll be a good boy and phone my local Toyota Contre directly, as the message suggests.

I do hope that what's going on under my Toyota's hood is of a higher quality than the code that's driving their website!