Comment On One at a Time

While looking for a mortgage company to refinance his loan, Evgeny Potashnik came across Australian Mortgage Options. They seemed decent enough; they even had an online loan management site. Curious to see what it offered, Evgeny took a peek… [expand full text]
« PrevPage 1 | Page 2Next »

Re: One at a Time

2007-07-27 09:15 • by Roman (unregistered)
Must be one of those subprime lenders...

Re: One at a Time

2007-07-27 09:16 • by Kev (unregistered)
I really wish someone would invent some sort of a structure that could perform repetative tasks, maybe call it a looping structure, or a loop?

Re: One at a Time

2007-07-27 09:16 • by Cyrus
Sadly, I don't know Javascript well enough if there is something like a control array that allows you to do this outside one giant block of code.

I suppose on the other hand you could just validate the entire number in a single text box though.

TRWTF is the text after the link to the bank website.

Re: One at a Time

2007-07-27 09:17 • by Look at me! I'm on the internets! (unregistered)
I come across this type of validation code all the time at work. - once one that validated 150 multiple choice test questions to see that each one had been answered.

Then another batch to mark the test, question by question and update a score.

Over 1000 lines of javascript which I replaced with about 30.

Re: One at a Time

2007-07-27 09:17 • by Look at me! I'm on the internets! (unregistered)
I come across this type of validation code all the time at work. - once one that validated 150 multiple choice test questions to see that each one had been answered.

Then another batch to mark the test, question by question and update a score.

Over 1000 lines of javascript which I replaced with about 30.

Re: One at a Time

2007-07-27 09:20 • by snoofle (unregistered)
147080 in reply to 147079
It's all about efficiency - unroll those loops - that's why they invented cut-paste-stream edit!

Re: One at a Time

2007-07-27 09:22 • by akatherder
147081 in reply to 147076
Kev:
I really wish someone would invent some sort of a structure that could perform repetative tasks, maybe call it a looping structure, or a loop?


And open oneself to the possibility of the dreaded infinite loop? No thank you sir!

Re: One at a Time

2007-07-27 09:23 • by Look at me! I'm on the internets! (unregistered)
147082 in reply to 147077
Cyrus:
Sadly, I don't know Javascript well enough if there is something like a control array that allows you to do this outside one giant block of code.

I suppose on the other hand you could just validate the entire number in a single text box though.

TRWTF is the text after the link to the bank website.


There are several ways to do it.
The most obvious, without getting involved in DOM is:

...
for (i = 1; i< 10; i++)
{
id = "FieldName" + i;
field = document.getElementById(id);
...
//do checking and warnings
}

There's also getElementsByName(),
which would return an array of all elements with the same name field. Use a common name, and unique ids and you just walk over the array spitting out warnings as you see fit.

Re: One at a Time

2007-07-27 09:27 • by Kev (unregistered)
147083 in reply to 147081
Your right ... what was I thinking? I think someone spiked my lunch with acid, thats the only way that could seem like a good idea...

Re: One at a Time

2007-07-27 09:31 • by Mike5 (unregistered)
I love how they use parseFloat(). I guess your loan number can be:
3.141592 2.71828 0.12345 etc...

Mike5

Re: One at a Time

2007-07-27 09:33 • by Strider
147086 in reply to 147082
Look at me! I'm on the internets!:
Cyrus:
Sadly, I don't know Javascript well enough if there is something like a control array that allows you to do this outside one giant block of code.

I suppose on the other hand you could just validate the entire number in a single text box though.

TRWTF is the text after the link to the bank website.


There are several ways to do it.
The most obvious, without getting involved in DOM is:

...
for (i = 1; i< 10; i++)
{
id = "FieldName" + i;
field = document.getElementById(id);
...
//do checking and warnings
}

There's also getElementsByName(),
which would return an array of all elements with the same name field. Use a common name, and unique ids and you just walk over the array spitting out warnings as you see fit.



Yeah but then you couldn't write those nice custom error messages...unless you did something like

string err = "The " +
switch(i) {
case 1 : "First"; break;
case 2 : "Second"; break;
...
}
+ " box should contain a number. Please try it again...")

But then, that would defeat the purpose aye?


and wth is decised??

Re: One at a Time

2007-07-27 09:34 • by sobani (unregistered)
Everyone is talking about loops, but one can't loop "first", "second", "third", etc. ha! puh!
(yes I know one can)

I quess this page was made by the cheapest contracter they could find: The 10 year old nephew.

Re: One at a Time

2007-07-27 09:36 • by sobani (unregistered)
147088 in reply to 147086
maybe store those "first", "second", etc in an array and look them up? Then you can still make a loop.

Re: One at a Time

2007-07-27 09:44 • by list-man (unregistered)
147090 in reply to 147088
sobani:
maybe store those "first", "second", etc in an array and look them up? Then you can still make a loop.

Wait - an array of input fields, and now another array of message strings? Stop being a weenie! Come on, we can use xslt to convert 1..n to "first", ... - this is, after all, a web page!

Re: One at a Time

2007-07-27 09:44 • by ssprencel
147091 in reply to 147087
sobani:
Everyone is talking about loops, but one can't loop "first", "second", "third", etc. ha! puh!
(yes I know one can)

I quess this page was made by the cheapest contracter they could find: The 10 year old nephew.


That's all fine and dandy but as a customer, that's not who you want to handle their collections. You might end up with broken kneecaps.

Re: One at a Time

2007-07-27 09:45 • by Raggles
...Or just rephrase it: "Box $BoxNumber must contain a number"

No messy arrays.

And no, I'm not a programmer. You get the idea though.

Re: One at a Time

2007-07-27 09:45 • by Cloak (unregistered)
Well, and then they gave up after the fifth field. You can also see that the programmer became tired after the fourth field already:

var First,Second,Third,Fourth,Fifth,Sixth,Seventh,Eight,Nineth,Tenth
...
Fouth = parseFloat(document.amo.l4.value);

and in the end these variables are never used. Great waste of time.

Re: One at a Time

2007-07-27 09:53 • by Iznogoud (unregistered)
I don't see any problem with that considering that the entire javascript-section could be scripted and output with an other language for example php?

<?php
$i = 1;
foreach(array("First","Second",..) as $var){
echo '
$var = parseFloat(document.amo.l$i.value);

if ((isNaN(document.amo.l$.value)) || (document.amo.l$i.value=="")) {
alert("The first box should contain a number. Please try it again...")
document.amo.l$i.focus()
return false
}';
$i++;
}
?>

Re: One at a Time

2007-07-27 09:58 • by snoofle (unregistered)
147095 in reply to 147094
Iznogoud:
I don't see any problem with that considering that the entire javascript-section could be scripted and output with an other language for example php?

<?php
$i = 1;
foreach(array("First","Second",..) as $var){
echo '
$var = parseFloat(document.amo.l$i.value);

if ((isNaN(document.amo.l$.value)) || (document.amo.l$i.value=="")) {
alert("The first box should contain a number. Please try it again...")
document.amo.l$i.focus()
return false
}';
$i++;
}
?>

Are you sure about that?

Re: One at a Time

2007-07-27 09:58 • by ssanchez (unregistered)
Umm, as my first post to WTF, I may be missing the point, but aren't you guys discussing what is the best way to validate a dozen text fields when part 1 of the WTF was that it wasn't just using one field in the first place?

Re: One at a Time

2007-07-27 10:07 • by abx
147098 in reply to 147096
ssanchez:
Umm, as my first post to WTF, I may be missing the point, but aren't you guys discussing what is the best way to validate a dozen text fields when part 1 of the WTF was that it wasn't just using one field in the first place?
Yeah, it's more or less custom to work out different ways to achieve something stupid in the comments, as the one solution that'd actually be good is often too obvious to be debated; and if there's nothing to debate, the comments section will contain nothing but "First!"-posts.

Re: One at a Time

2007-07-27 10:12 • by Iznogoud (unregistered)
147099 in reply to 147095
snoofle:
Iznogoud:

alert("The first box should contain a number. Please try it again...")
?>

Are you sure about that?


An obvious typo, insert strtolower() where appropriate.

Re: One at a Time

2007-07-27 10:15 • by Look at me! I'm on the internets! (unregistered)
147100 in reply to 147096
ssanchez:
Umm, as my first post to WTF, I may be missing the point, but aren't you guys discussing what is the best way to validate a dozen text fields when part 1 of the WTF was that it wasn't just using one field in the first place?


You may be correct, but I can't wave my e-penis around by posting:

<input type="text" name="loanNum" size="10">

Re: One at a Time

2007-07-27 10:16 • by Anonymous (unregistered)
While you're all whinging about unrolled loops, frankly I'm more concerned about this:


if((document.amo.l1.value=="3") || (document.amo.l1.value=="0")){
document.amo.action="javascript:OpenOLBWindow();"
} else {
document.amo.action="javascript:doOpen2()"
}


Anyone care to speculate on why numbers starting with zero or three are so special, and what the difference is between the two functions?

If this client-side validation is symptomatic of the company's web security, Evgeny made the right call by walking away IMHO...

Re: One at a Time

2007-07-27 10:22 • by AdT (unregistered)
The Real WTF is that they mispelt Frist.

Nientinth Psot!

Re: One at a Time

2007-07-27 10:22 • by snoofle (unregistered)
147104 in reply to 147101
Anonymous:
While you're all whinging about unrolled loops, frankly I'm more concerned about this:


if((document.amo.l1.value=="3") || (document.amo.l1.value=="0")){
document.amo.action="javascript:OpenOLBWindow();"
} else {
document.amo.action="javascript:doOpen2()"
}


Anyone care to speculate on why numbers starting with zero or three are so special, and what the difference is between the two functions?

If this client-side validation is symptomatic of the company's web security, Evgeny made the right call by walking away IMHO...

I've worked at a bunch of financial institutions. In more than one place, account numbers starting with a certain prefix usually indicated a certain type of account. Perhaps in this case, a prefix digit of 0 means type x and a prefix digit of 3 means type y, etc. If that's the case, then opening a different web page to display different types of account data makes sense. If this was supposed to be security, then (all together now): wtf?!

Re: One at a Time

2007-07-27 10:22 • by akatherder
147105 in reply to 147100
Look at me! I'm on the internets!:

You may be correct, but I can't wave my e-penis around by posting:
<input type="text" name="loanNum" size="10">


maxlength=10!

sobani:

I quess this page was made by the cheapest contracter they could find: The 10 year old nephew.


Quess?

Re: One at a Time

2007-07-27 10:25 • by Aaron Bassett (unregistered)
The HTML bit
<input type='text' name='box1' id='box1' title='first field' />

<input type='text' name='box2' id='box3' title='second field' />


The Javascript
function Funder() {

var errorStr = false;
// Assume form contains only the box inputs and a submit button
var n = document.getElementById('formName').getElementsByTagName('input')-1;
var el;
for(var i=0; i < n; i++) {
el = document.getElementById('box'+i);
if(isNan(el.value)) {
el.value = '';
errorStr += "The " + el.title + " must contain a number.\n";
}
}

if(errorStr) {
errorStr += "Please corrent these errors and try again.";
alert(errorStr);
return false;
}
return true;
}


which could then be called on the form like onsubmit="return Funder();" and has the advantage of not popping up 1 alert for every with an error, which IMHO was the biggest wtf of the code in question.

Accidentally hit submit on the form without filling any fields and get bombarded with alert boxes >.<

Re: One at a Time

2007-07-27 10:27 • by Aaron Bassett (unregistered)
var n = document.getElementById('formName').getElementsByTagName('input').length-1;

even......

Re: One at a Time

2007-07-27 10:31 • by Jack (unregistered)
That must have been a fun project to manage. Snippet from the daily Scrum:
Programmer: "I wrapped up the code for text boxes seven and eight yesterday. Started on #9 this morning and hope to have #10 partially implemented before lunch."
(sounds of hand-slaps and cheering from the rest of the retards on this project)

Re: One at a Time

2007-07-27 10:32 • by Sgt. Preston (unregistered)
147109 in reply to 147082
Look at me! I'm on the internets!:
There are several ways to do it.
The most obvious, without getting involved in DOM is:

...
for (i = 1; i< 10; i++)
{
id = "FieldName" + i;
field = document.getElementById(id);
...
//do checking and warnings
}

There's also getElementsByName(),...
How do you figure you can use document.getElementById() or document.getElementsByName() "without getting involved in DOM"? You're up to your nipples in DOM already.

Re: One at a Time

2007-07-27 10:33 • by mrs_helm (unregistered)
So far no one has posted the security wtf of this - which is that since it's made clear that account numbers are 10 digits of only 0-9, it is VERY easy to guess a valid account number.

Hopefully there's further authentication on the next page to actually see account data. But looking at what they've got so far, I wouldn't trust it even if it exists...

Re: One at a Time

2007-07-27 10:37 • by blah (unregistered)
"Simply provide your loan number below"

Simply, indeed.

Re: One at a Time

2007-07-27 10:38 • by joan (unregistered)
147112 in reply to 147110
The best part of this super cool interface, is the code behind it.

Not only is it a WTF, but the developer appears quite proud of his/her designs... check out this meta tag in the source.

<meta name="generator" content="hand coded in notepad">

a.) hand coded - thats fine, be prowd
b.) in notepad - OMG, please tell me this is not the case

Re: One at a Time

2007-07-27 10:41 • by Look at me! I'm on the internets! (unregistered)
147113 in reply to 147101
Anonymous:
While you're all whinging about unrolled loops, frankly I'm more concerned about this:


if((document.amo.l1.value=="3") || (document.amo.l1.value=="0")){
document.amo.action="javascript:OpenOLBWindow();"
} else {
document.amo.action="javascript:doOpen2()"
}


Anyone care to speculate on why numbers starting with zero or three are so special, and what the difference is between the two functions?

If this client-side validation is symptomatic of the company's web security, Evgeny made the right call by walking away IMHO...


Did a bit of testing. If I start with 3, I get taken to a login page. If I start with 2, I get a "Sorry, the Loan Service Net is currently unavailable." page.

The login page has a random number to letter mapping,

0 1 2 3
R X Q C ...

so to type in my client code, "123" I would have to type in "XQC"

Re: One at a Time

2007-07-27 10:42 • by ssprencel
147114 in reply to 147106
Aaron Bassett:
The HTML bit
<input type='text' name='box1' id='box1' title='first field' />

<input type='text' name='box2' id='box3' title='second field' />


The Javascript
function Funder() {

var errorStr = false;
// Assume form contains only the box inputs and a submit button
var n = document.getElementById('formName').getElementsByTagName('input')-1;
var el;
for(var i=0; i < n; i++) {
el = document.getElementById('box'+i);
if(isNan(el.value)) {
el.value = '';
errorStr += "The " + el.title + " must contain a number.\n";
}
}

if(errorStr) {
errorStr += "Please corrent these errors and try again.";
alert(errorStr);
return false;
}
return true;
}


which could then be called on the form like onsubmit="return Funder();" and has the advantage of not popping up 1 alert for every with an error, which IMHO was the biggest wtf of the code in question.

Accidentally hit submit on the form without filling any fields and get bombarded with alert boxes >.<


Better yet, put in legitimate data and hit the submit button and you get the following error:

Sorry, the Loan Service Net is currently unavailable.



The service is temporarily unavailable.


Normal hours of operation are 6am to midnight (E.S.T.)

Please try again during these times.

Note that the Loan Service Line is also available for your convenience at these times.


I tried this at 10:37 EST.

Re: One at a Time

2007-07-27 10:45 • by Cloak (unregistered)
147115 in reply to 147110
mrs_helm:
So far no one has posted the security wtf of this - which is that since it's made clear that account numbers are 10 digits of only 0-9, it is VERY easy to guess a valid account number.

Hopefully there's further authentication on the next page to actually see account data. But looking at what they've got so far, I wouldn't trust it even if it exists...


Try it, there is an authentication right after and valid contracts with 5 numbers only are possible. Only fields 1 to 5 are validated. That might be the reason why there is no loop for verification.

Re: One at a Time

2007-07-27 10:58 • by dkf (unregistered)
147117 in reply to 147115
Cloak:
That might be the reason why there is no loop for verification.
But that just leaves me thinking that the whole mess is The Real WTF!

Re: One at a Time

2007-07-27 11:02 • by Andrew (unregistered)
I love how people like to get fancy with JS. Bank account numbers shouldn't be verifed on the client side anyway. You've told a wold be hacker how long the account number is now. The more you verify the more details about the account number you give up.

Re: One at a Time

2007-07-27 11:12 • by SomeCoder (unregistered)
147120 in reply to 147108
Jack:
That must have been a fun project to manage. Snippet from the daily Scrum:
Programmer: "I wrapped up the code for text boxes seven and eight yesterday. Started on #9 this morning and hope to have #10 partially implemented before lunch."
(sounds of hand-slaps and cheering from the rest of the retards on this project)


As someone who participates in daily stand ups for Scrum for my work... this comment made coffee shoot out of my nose :)

Re: One at a Time

2007-07-27 11:13 • by fievel (unregistered)
147121 in reply to 147114
ssprencel:

Sorry, the Loan Service Net is currently unavailable.



The service is temporarily unavailable.


Normal hours of operation are 6am to midnight (E.S.T.)

Please try again during these times.

Note that the Loan Service Line is also available for your convenience at these times.


I tried this at 10:37 EST.


ROTFL. It's the first time I see a online banking website which open only on working hours ...

Re: One at a Time

2007-07-27 11:32 • by T $
Now why would they put each one in a separate textbox? Oh, I know, to slow down password guessers rather than having built-in lockout mechanisms. Possible?

Re: One at a Time

2007-07-27 11:41 • by ehartwell
147129 in reply to 147120
Jack:
That must have been a fun project to manage. Snippet from the daily Scrum:
Programmer: "I wrapped up the code for text boxes seven and eight yesterday. Started on #9 this morning and hope to have #10 partially implemented before lunch."
(sounds of hand-slaps and cheering from the rest of the retards on this project)

Nonsense! This is clearly a classic, top-down, flowchart and keypunch shop. You can be sure this programmer consistently earns a bonus for the outstanding number of Lines Of Code produced per day.

Re: One at a Time

2007-07-27 11:42 • by SomeCoder (unregistered)
147130 in reply to 147121
fievel:


ROTFL. It's the first time I see a online banking website which open only on working hours ...



My university's website is only available from like 7:00 AM - 10:00 PM. Then they take it completely offline to perform database back ups.

That entire website is one giant WTF. Yes, I go to WTFU.

Re: One at a Time

2007-07-27 11:48 • by John Doe (unregistered)
147134 in reply to 147114
ssprencel:
The service is temporarily unavailable.

Normal hours of operation are 6am to midnight (E.S.T.)

Please try again during these times.

Note that the Loan Service Line is also available for your convenience at these times.[/code]

I tried this at 10:37 EST.

Why would an _Australian_ company care about EST? Or does it also stand for "EasternAustralia" Standard Time?

Re: One at a Time

2007-07-27 11:50 • by Gert (unregistered)
147137 in reply to 147086
ever heard of arrays? and btw, switch is a control statement, not a valid operand - this isn't perl

Re: One at a Time

2007-07-27 11:53 • by Mogden (unregistered)
Clearly not. Only the United States is large enough to have an Eastern time zone.

Re: One at a Time

2007-07-27 12:07 • by seejay
147145 in reply to 147100
Look at me! I'm on the internets!:
You may be correct, but I can't wave my e-penis around by posting:

<input type="text" name="loanNum" size="10">


I don't have an e-penis. :( What can I wave around instead??

-- Seejay

Re: One at a Time

2007-07-27 12:45 • by Someone You Know
147157 in reply to 147134
John Doe:
Why would an _Australian_ company care about EST? Or does it also stand for "EasternAustralia" Standard Time?


There are three time zones called Eastern Standard Time, in Australia, Brazil, and Canada/US.

Re: One at a Time

2007-07-27 13:20 • by NotanEnglishMajor (unregistered)
Has anyone noticed how NaN this function is getting?

http://worsethanfailure.com/Articles/Pop-up_Potpourri_0x3a__It_0x27_s_Getting_a_Little_NaN_Outside.aspx
« PrevPage 1 | Page 2Next »

Add Comment