You are viewing limited content. For full access, please sign in.

Question

Question

Put default value in address field

asked on May 22, 2020

I am using out of the box Address field in Forms. I need to default the country to 'USA' and make it read only. How do I do that?

 

Thanks

Priya

0 0

Replies

replied on May 22, 2020 Show version history

Hi Priya,

You can add the following JavaScript to automatically make the country "USA" and to make it read-only:

$(document).ready(function() {
  var addressID = ?;
  //autofill country field and make it read-only
  $("#Field"+addressID+"_DSG3").val("USA").change().prop("readonly",true);
});

Just replace the question mark in the second line with the ID number of your address field.

If you ever need to do the same for the state field, you can change the "DSG5" to "DSG3".

1 0
replied on May 22, 2020

Thanks

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.