Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 6 of 6

Thread: Add Custom JS Function to check state is using correct zip

  1. #1
    DreamBen is offline Junior Member
    Join Date
    Jul 2010
    Location
    Rowland Heights, CA
    Posts
    3

    Exclamation Add Custom JS Function to check state is using correct zip

    Hi everyone. We have been noticing an issue with our customers not selecting the state from the list and it being left with the default value (Alabama). I wrote up a fix for this but it requires me to embed a custom JS function to the forms in question. Currently I have not been able to find where the actual form/html code is being generated from so I can add this in there. The exact pages in question are:
    http://www.oursite.com/checkout1.aspx
    http://www.oursite.com/address.aspx

    We are using AspDotNetStorefront ML 9.0.1.2, and using C#. Any help would be awesome. Thank you!
    Last edited by DreamBen; 07-27-2010 at 09:22 AM.

  2. #2
    ASPAlfred is offline Senior Member
    Join Date
    Nov 2007
    Posts
    2,244

    Default

    What is exactly the issue you're seeing?

    Yes, if the user forgot to select from the state drop down list, by default will be populated with value equal to Alabama (considering Alabama is displayed first from the list).

    There is an issue however in Get Tax Estimate - state dropdown. Not sure if this is what you're referring.

  3. #3
    DreamBen is offline Junior Member
    Join Date
    Jul 2010
    Location
    Rowland Heights, CA
    Posts
    3

    Default

    Quote Originally Posted by AspDotNetStorefront Staff - Alfred View Post
    What is exactly the issue you're seeing?

    Yes, if the user forgot to select from the state drop down list, by default will be populated with value equal to Alabama (considering Alabama is displayed first from the list).

    There is an issue however in Get Tax Estimate - state dropdown. Not sure if this is what you're referring.
    Hi Alfred, thanks for replying. Well, the issue arises when we need to mail packages. Sometimes if the state is incorrect obviously the package gets sent to the wrong state because not all carriers check to see if the zip is correct for the state. I wrote a javascript function to automatically select the correct state using the zip...but I cannot find in the source code where to modify the forms. And yes, also if the incorrect state is selected we calculate the tax incorrectly as well.

  4. #4
    Alkaline is offline Senior Member
    Join Date
    May 2006
    Posts
    459

    Default

    The best way to handle this is to have a zipcode database that checks to see if they zipcode is in the correct state, we did something similar to checkout for some sites and it cut down the wrong state problems

    e.g. https://nutrasupply.com/c-596-perfor...endurance.aspx add anything to your cart and go to checkout, on the checkout page, it asks for zip before the city, state, country or phone, based on the zip the city state and area code are already filled out.

    Cuts down on incorrect sign ups. NOTE, another cool feature is that you can get shipping estimates SIMPLY by supplying the zipcode.

    check online their are various places selling zipcode databases for about 30 bucks.
    Simrun AspDotNetStoreFront Development
    Preferred AspDotnetStorefront Development Partner
    ahsan[@]simrun[.]com
    remove the "[]" for email

    Have a Nice Day

  5. #5
    DreamBen is offline Junior Member
    Join Date
    Jul 2010
    Location
    Rowland Heights, CA
    Posts
    3

    Default

    Quote Originally Posted by Alkaline View Post
    The best way to handle this is to have a zipcode database that checks to see if they zipcode is in the correct state, we did something similar to checkout for some sites and it cut down the wrong state problems

    e.g. https://nutrasupply.com/c-596-perfor...endurance.aspx add anything to your cart and go to checkout, on the checkout page, it asks for zip before the city, state, country or phone, based on the zip the city state and area code are already filled out.

    Cuts down on incorrect sign ups. NOTE, another cool feature is that you can get shipping estimates SIMPLY by supplying the zipcode.

    check online their are various places selling zipcode databases for about 30 bucks.
    Thanks for the reply but I already have that end handled I now just need to know how to go about modifying the source to add my JS function to an onblur event attached to the forms in question.

  6. #6
    jfenig is offline Junior Member
    Join Date
    Nov 2010
    Posts
    1

    Default Ben, is it working?

    Ben,
    i'm wondering if you got your script working? if so, would you be willing to share the code and where you installed it? if not, pls tell more about what problem you are encountering. Maybe we can help.