Trigger conditions according to the country where the form is opened

  • Profile Image
    bhanukaran
    Asked on September 05, 2013 at 03:20 AM

    Hi Team,

    Since, we are doing mulit-country contest using your Jotform in Middle East. We have 5 countries which includes Saudi Arabia.

    Saudi is very particular about the language that they speak and read. Hence, we want to know if i can set my radio buttons in such as way that if the form opens in Saudi Arabia then should automaticall toggle to Arabic instead of having it in english by default. 

    How can i achieve this using Jotform.

    Here is the link of the form that we integrated using the js file downloaded from Jotform.

     

    Kindly suggest.

    Thanks

    Bhanu

  • Profile Image
    EltonCris
    Answered on September 05, 2013 at 05:27 AM

    Hi Bhanu,

    That's not possible unfortunately. That's pretty beyond in our form builder. We do not have such function. You may however use custom source code and use 3rd party scripts that detects IP/Country so you can trigger conditions depending on what country your form is opened.

    This might help: http://jquery-plugins.net/jqIpLocation/jqIpLocation.html

    Thanks!

  • Profile Image
    bhanukaran
    Answered on September 05, 2013 at 05:35 AM

    Thanks Elton. 

    So just to summarize again, if i am using your javascript code to do custom can i add this custom javascript code on your form to do it right ?

    Please confirm if it is do-able??

    Thanks

    Bhanu

  • Profile Image
    guilledutra
    Answered on September 05, 2013 at 09:16 AM

    Hi,

    you will be able to achieve what you are looking for using the jquery plugin provided by @EltonCris. You can paste a copy of that plugin inside the "js" folder at your form's source code, then  link it using the <script> tags inside the HTML downloaded within the formś source code.

    Thanks

  • Profile Image
    EltonCris
    Answered on September 05, 2013 at 12:28 PM

    @Bhanu

    Here I came up with another script that detects the country and auto-check the appropriate radio language option.

    <script language="JavaScript" src="//www.geoplugin.net/javascript.gp" type="text/javascript"></script>

    <script language="Javascript"> 

    var country = geoplugin_countryCode();

    if (country === 'SA') {

        //if country is saudi change language to Arabic

        document.getElementById('input_21_0').checked = false;

    document.getElementById('input_21_1').checked = true;

    } else {

        //otherwise default to English

    document.getElementById('input_21_0').checked = true;

    document.getElementById('input_21_1').checked = false;

        }

      </script>

    Just add this at the bottom part of your form source code right before the ending </body> tag.

    Hope this helps. Thanks!

  • Profile Image
    bhanukaran
    Answered on September 05, 2013 at 04:18 PM

    Thanks for the support. Will this script work on Secured forms or the server which has SSL certificates.

    Kindly suggest. As we have been using secured form version of Jotform

    Thanks

    Bhanu

  • Profile Image
    Mike_T
    Answered on September 05, 2013 at 05:56 PM

    They provide the SSL version of their location checker for €12 per year.

    http://www.geoplugin.com/premium#ssl_access_per_year

    And usage:

    http://www.geoplugin.com/webservices/ssl

    So script will be like:

    <script language="JavaScript" src="https://ssl.geoplugin.net/json.gp?k=<YOUR_KEY>" type="text/javascript"></script>

    <script language="Javascript">

    var country = geoplugin_countryCode();

    if (country === 'SA') {

    //if country is saudi change language to Arabic

    document.getElementById('input_21_0').checked = false;

    document.getElementById('input_21_1').checked = true;

    } else {

    //otherwise default to English

    document.getElementById('input_21_0').checked = true;

    document.getElementById('input_21_1').checked = false;

    }

    </script>

    You should be able to use it along with our secure form source code.

  • Profile Image
    bhanukaran
    Answered on September 08, 2013 at 03:10 AM

    Thanks a lot for all the help provided by you guys. We are going ahead with your solution as it works for us really well.

    Bhanu

  • Profile Image
    EltonCris
    Answered on September 08, 2013 at 03:22 AM

    That's great to hear. Cheers!