Ok...so weird question for you....

    Date: 10/12/07 (Javascript Community)    Keywords: asp, java

    Ok, we've got a form where people put in their first name, last name, email address, and a five digit number. On the confirmation page, we want to return to them: the first initial of their first name and full last name and then the first initial of their first name, first initial of their last name, and the five digits they put in.

    For example, if I entered:
    First Name: Brittany
    Last Name: Jackson
    5 Digits: 12345

    I would want returned:
    bjackson
    bj12345

    We are using Javascript for it, and where it previously worked, it suddenly stopped working.

    On the form page, the javascript we have in the header is:

    //
    function verify(form) {
    var errors='';
    if ((document.form.first.value == "") || (document.form.last.value == ""))
    errors+="Please enter your first and last name.\n";
    if (errors){
    alert(errors)
    return false;}

    fa = document.form.first.value.charAt(0);
    la = document.form.last.value.charAt(0)

    var len;
    var aryText = new Array()
    var hyp = "";

    if (document.form.last.value.indexOf ('-') != -1) {
    len = document.form.last.value.indexOf('-')
    for (var i = 0; i < len) i++; {
    aryText[i] = document.form.last.value.charAt(i);
    hyp = hyp + aryText[i];
    }
    document.form.username.value = fa.toLowerCase() + hyp.toLowerCase();
    }

    else if (document.form.last.value.indexOf (' ') != -1) {
    len = document.form.last.value.indexOf(' ')
    for (var i = 0; i < len) i++; {
    aryText[i] = document.form.last.value.charAt(i);
    hyp = hyp + aryText[i];
    }
    document.form.username.value = fa.toLowerCase() + hyp.toLowerCase();
    }

    else{
    document.form.username.value = fa.toLowerCase() + document.form.last.value.toLowerCase();
    }
    document.form.code.value = fa.toLowerCase() + la.toLowerCase() + document.form.numbers.value;
    return true;
    }
    //

    The words after form relate to the fields in the form.


    And then in the body, under the start of the form class we have (obviously these would have the start and end tags (<>):

    form class="forms" name="forms" action="oursite.asp" method="post"

    input type="hidden" name="code"
    onchange="javascript:this.value=this.value.toLowerCase();" /
    input type="hidden" name="username"
    onchange="javascript:this.value=this.value.toLowerCase();" /

    On our confirmation page/asp page we have:

    //

Name Username* E-mail Address* Code

<% Response.Write(first)
Response.Write(" ")
Response.Write(last) %>
<% Response.Write(username) %> <% Response.Write(username) %>@oursite.org <% Response.Write(code) %>
//

It currently returns the first and last name, but nothing else. Again, as far as anyone knows, no changes were made to this page and it had been working for over one year. In the last 2-3 weeks sometime, it suddenly stopped and we can't track down why or how.

Can someone see something that we're missing? The person who originally created this has since left and no one really knows a ton about javascript. I've been researching for days and am at a loss.

I would appreciate it!! Thank you!!

Source: http://community.livejournal.com/javascript/142636.html

« Debugging idea || talk about useful... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home