HOME / COMMUNITY Switch to knowledge base

JavaScript to set Defaults on adding a Client


#1

Can you please provide JS code to set the following parameters upon creating a new Client record:

  • Client Country to Poland,
  • Default Currency to PLN,
  • Default Language to Polish.

Thank you :slight_smile:


#2

Hi @marekkowalczyk

Something like this should do the trick. I’ve added comments, so if any one else wants to adapt it for other settings it should (hopefully) be straightforward.

$(document).ready(function() {

    if($('.page-clients-modify #hiddencID').val() == 0)
    {
        $('.page-clients-modify #dropcurrency').val('PLN'); // change to 3 letter currency code of your choice
        $('.page-clients-modify #dropCountry').val('PL');   // change to 2 letter country code of your choice
        $('.page-clients-modify #droplanguage').val('po');  // change to 2 letter language code of your choice   
    }

});

You only need one $(document).ready(function() { in your script, so if one already exists, paste the code, excluding the first and last lines, into the existing code you already have.

Hope that helps! :slight_smile:


#3

… but it won’t do any harm if you have more than one, they all get run in sequence.


#4

No, very true :slight_smile:

It’s down to personal preference


#5

This topic was automatically closed after 7 days. New replies are no longer allowed.