• Resolved Hjorth007

    (@hjorth007)


    Hi there
    I have installed your plugin, as I think it can do what I need…. Unfortunately I am not to familiar with the math and the codes, so this is probably a stupid question…. ??
    I would like to create a simple form with two fields. One where the user can enter his zipcode, and another field to show him what the cost will be in his area. (because of the distance I have to drive). I have set the price for all the zipcodes, so if the user f.i. types in “8000”, the form should return “600”, as it costs 600 DDK to get the service done in that zipcode-area. It actually doesn’t calculate, it just returns a number I have set.
    I do understand how to use the plugin, but I cant seem to get it to do what I need. Hope you can help me out.
    Thanks in advance.
    Henrik

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @hjorth007

    If there is a field to allow the users enter their zipcodes (I’ll assume it is the fieldname1), and you know the price per zipcode, you can to define a plain object as part of the equation, with the list of zipcodes as its attributes, and the corresponding prices as the attributes’ values, and to use the value entered by the user for filtering.

    For example, the equation associated to the calculated field could be:

    
    (function(){
    var zipcodes = {'8000':600,'8001':605,'8002':700,'8031':505};
    if(fieldname1 in zipcodes) return zipcodes[fieldname1];
    return 'The zipcode is not supported';
    })()
    

    The name of field, the zipcodes and values are hypothetical, only to describe a possible solution.

    Best regards.

    Thread Starter Hjorth007

    (@hjorth007)

    Wow, quick and effectfull response. Thanks a lot, this was exactly what I needed! ??

    Thread Starter Hjorth007

    (@hjorth007)

    Ooh…. by the way, is there a way to group some of the zipcodes ? Some of them have the same price. ??

    Plugin Author codepeople

    (@codepeople)

    Hello @hjorth007

    You simply should to include new attributes, with the different zipcodes, even if they have the same value associated.

    Best regards.

    Thread Starter Hjorth007

    (@hjorth007)

    OK, thanks again. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Zipcode prize form’ is closed to new replies.