We dont need to process this form.



  • Its only client-side javascript, but someone still needs to learn what 'return' does.

    function CheckForm(form) {
    return true;
    form.sbmt.value = "Processing order, please wait...";
    form.sbmt.disabled = true;
    form.sbmt.style.borderColor = '#c0c0c0';
    form.sbmt.style.color = '#a0a0a0';
    form.sbmt.style.backgroundColor = '#e0e0e0';
    return true;
    return confirm('Are you sure you filled up all fields correctly?');
    }

     



  • I'm going to ignore the return trues for a second and focus on that 'brillant' confirmation box.  I mean, how dumb is that?  It should be obvious to everyone that he's missing the required "return confirm('But are you absolutely positively sure you filled up all fields correctly?')" box.



  • I wonder how long the "developer" sat around wondering why none of his properties were being set....



  • [quote user="kaamoss"]I wonder how long the "developer" sat around wondering why none of his properties were being set....
    [/quote]

    Unless someone's actually complained, my money is on the developer dicking around, and accidentally leaving this in production code instead of stripping it out. Is that method even called anywhere?



  • I would guess it's the clunky "mix script in a tag" onsubmit="CheckForm(this)"

    I take that back, 'this' is probably something like document.formname

    In any case, the function doesn't do what its name implies but just some window dressing. As a result it isn't necessary (I'd question the need for a "Positive you haven't been a dumbass in filling this form?")



  • most likely the client said "get rid of that yes or no thing" and he added a return true in front of it in case they wanted it back later.

    then they probably said "don't disable the button, and don't change its color... etc"  so he put a return at the top of the function.

    it's lazy... he should have commented it out, or stripped it out... but i think it's just a case of laziness not a WTF



  • [quote user="HockeyGod"]

    most likely the client said "get rid of that yes or no thing" and he added a return true in front of it in case they wanted it back later.

    then they probably said "don't disable the button, and don't change its color... etc"  so he put a return at the top of the function.

    it's lazy... he should have commented it out, or stripped it out... but i think it's just a case of laziness not a WTF

    [/quote]

    Well if you take out all of the return trues, you still have a WTF in terms of error checking.  Just passes the buck:  ask the user to double-check everything he entered to make sure it's valid, then accept it!
     



  • Yep, the code is called via <form onSubmit="return CheckForm(document.forms[0])">



  • So if the two 'return true' statements are ommitted, and I submit the form, this method disables the form and displays a confirmation box, then realize I made an error so I click 'cancel'... how would the form be re-enabled?  perhaps thats why this method was 'disabled'?


Log in to reply