automatic estimate from website

Discussion in 'Digital Marketing' started by freshfitz, Aug 30, 2007.

  1. freshfitz

    freshfitz LawnSite Member
    Posts: 5

    Check this out i am working on a automatic website estimate page it pulls sqft and a high res image pretty cool stuff

    http://vortexlawn.com/estimate/

    try this address and it will return a high res pic

    407 KISMet
    philadelphia, PA 19115
     
  2. Dirty Water

    Dirty Water LawnSite Fanatic
    Posts: 6,794

    Some advice for your validation code. I see you have a wrapper function for doing regular expression testing, but you don't seem to actually do it anywhere.

    For example, your phone number validation code:

    Code:
    function CheckPhoneNumber(TheNumber) {
    var valid = 1
    var GoodChars = "0123456789()-+. "
    var i = 0
    if (TheNumber=="") {
    // Return false if number is empty
    return false;
    	}
    for (i =0; i <= TheNumber.length -1; i++) {
    if (GoodChars.indexOf(TheNumber.charAt(i)) == -1) {
    // Note: Remove the comments from the following line to see this
    // for loop in action.
    // alert(TheNumber.charAt(i) + " is no good.")
    return false;
    } // End if statement
    	} // End for loop
    return true;
    }
    
    Could be replaced using a regular expression with this:

    Code:
    function validatePhone(theNumber)
    { 
        var phoneRE = /^[2-9]\d{2}-\d{3}-\d{4}$/;
        return (phoneRE.test(theNumber))
    }
    
    Because you are using a regular expression, this allows for numbers like this:

    (555)-555-555 or 555-555-5555 and many other variations of how someone would enter it, but will always catch an invalid one.

    The same goes for your zipcode validator:

    Code:
    function CheckZipCode(TheNumber) {
    var valid = 1
    var GoodChars = "0123456789-"
    var i = 0
    if (TheNumber=="") {
    // Return false if number is empty
    return false;
    } else if (TheNumber.length < 5) {
    return false;		
    }
    for (i =0; i <= TheNumber.length -1; i++) {
    if (GoodChars.indexOf(TheNumber.charAt(i)) == -1) {
    // Note: Remove the comments from the following line to see this
    // for loop in action.
    // alert(TheNumber.charAt(i) + " is no good.")
    return false;
    } // End if statement
    	} // End for loop
    return true;
    }
    
    This could be replaced entirely with:

    Code:
    function isValidZipCode(value) {
       var re = /^\d{5}([\-]\d{4})?$/;
       return (re.test(value));
    }
    
    This allows for 5 digit zipcodes, or the full 5 digit + 4 digit prefix zipcodes, and is done in 2 lines of code.

    If you are not familiar with regular expressions, and you do write validation code, you have no excuse to not learn how to use them :)
     
  3. Dirty Water

    Dirty Water LawnSite Fanatic
    Posts: 6,794

    Also, why are you using Coldfusion? That is a dead language man. You want to be able to install this on clients servers right?
     
  4. WebMan

    WebMan LawnSite Member
    from D/FW TX
    Posts: 11

    I dunno, Is it supposed to show a map? :confused:
    I got the estimate etc. but couldn't get a map no matter how hard I tried, and a customer wouldn't try that hard.
    Also think drop down of all states is overkill, surely most contractors only use a few.
     
  5. topsites

    topsites LawnSite Fanatic
    Posts: 21,653

    I wouldn't do it, too many negative side effects, such as loss leaders galore, I can see it now ...
    You'll end up loading up all your stuff and driving to all these places that'll make your eyes pop out in disbelief, is my take on what will happen.

    You could re-phrase it some kind of way but then it's not a valid estimate, that would be the closest I'd go thou.
    Something like a 'price guide estimator'
    Now your competitors get a free calculator...
    Can't think of anything else but I'm sure there's more.

    Somewhere along 1 / 10 to 1 / 100 filled out estimates are likely to turn into some actual kind of work you can do, and as more people get wind of it the figures might get even worse. For all that I'd rather answer the phone, at least I can cherry pick some off right there, then again it might be possible to do that online but I don't know how...
    That's why I never did it.
     

Share This Page