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

    (@codepeople)

    Hi,

    The Calculated Fields Form is a plugin to create forms on website. The plugin is not for searching on website’s content.

    Could you give me more details about your project, please?

    Best regards.

    Thread Starter ramonjosegn

    (@ramonjosegn)

    Really I only need know if two cities are connect with a route bus, I think should be use javascript and this calculator…

    Plugin Author codepeople

    (@codepeople)

    Hi,

    To use the calculated field for this project, you should have knowledges of javascript. For example, if your form includes two drop-down fields for cities, fieldname1 and fieldname2, with values ( A, B, C ) and ( D, E, F ) respectively, and an array of cities and routes, like follow:

    var routes = [
    {‘from’ : ‘A’, ‘to’ : ‘D’, ‘route’ : 4 },
    {‘from’ : ‘A’, ‘to’ : ‘E’, ‘route’ : 6 },
    {‘from’ : ‘A’, ‘to’ : ‘F’, ‘route’ : 8 },
    {‘from’ : ‘B’, ‘to’ : ‘D’, ‘route’ : 4 },
    {‘from’ : ‘B’, ‘to’ : ‘E’, ‘route’ : 6 },
    {‘from’ : ‘B’, ‘to’ : ‘F’, ‘route’ : 8 },
    {‘from’ : ‘C’, ‘to’ : ‘D’, ‘route’ : 4 },
    {‘from’ : ‘C’, ‘to’ : ‘E’, ‘route’ : 6 },
    {‘from’ : ‘C’, ‘to’ : ‘F’, ‘route’ : 8 }
    ];

    The equation would be similar to:

    (function(){
    var routes = [
    {‘from’ : ‘A’, ‘to’ : ‘D’, ‘route’ : 4 },
    {‘from’ : ‘A’, ‘to’ : ‘E’, ‘route’ : 6 },
    {‘from’ : ‘A’, ‘to’ : ‘F’, ‘route’ : 8 },
    {‘from’ : ‘B’, ‘to’ : ‘D’, ‘route’ : 4 },
    {‘from’ : ‘B’, ‘to’ : ‘E’, ‘route’ : 6 },
    {‘from’ : ‘B’, ‘to’ : ‘F’, ‘route’ : 8 },
    {‘from’ : ‘C’, ‘to’ : ‘D’, ‘route’ : 4 },
    {‘from’ : ‘C’, ‘to’ : ‘E’, ‘route’ : 6 },
    {‘from’ : ‘C’, ‘to’ : ‘F’, ‘route’ : 8 }
    ];

    for( var i = 0; i < routes.length; i++ )
    {
    if( fieldname1 == routes[i][‘from’] && fieldname2 == routes[i][‘to’] )
    {
    return routes[i][ ‘route’ ];
    }
    }
    return ”;
    })()

    I hope the demo help you to create your own equation.
    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Is possible find routin bus with this plugin? thanks’ is closed to new replies.