Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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