1

How can I make the default country as India, default state as West Bengal and city as Kolkata in a Cognito form?

1 Answer 1

3

I'm part of the support team here at Cognito Forms.

In order to do this, your first step would be to mark your Address field as "International" within the Field Settings, then save.

Next, you'll need to use your embed code. The last line before the end of the <div> tag should currently look something like this:

<script>Cognito.load("forms", { id: "50" });</script>

What you'll need to do is use this line of the embed code to add field targeting so you can set a default value. After your form's unique ID number, you'll need to add a comma, then space, then the following:

entry:{Address:{City:"DEFAULT", State:"DEFAULT", PostalCode:"DEFAULT", Country:"India"}}

With each of the three DEFAULT words being the actual values you want to preset.

So your whole line of code should look like this:

<script>Cognito.load("forms", { id: "50", entry:{Address:{City:"DEFAULT", State:"DEFAULT", PostalCode:"DEFAULT", Country:"India"}}});</script>

Just be sure to use your actual embed code so the form ID is correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.