Remove country option from Address block

  • Profile Image
    elegance
    Asked on January 14, 2011 at 10:32 PM

    I am only selling within the United States and altough I found the option to default to USA, I want to remove the options so it is very clear that I won't ship internationally.  I am embedding the form.  I was able to remove country when I placed the source code in my site, but that killed the formatting.

  • Profile Image
    drrchrds
    Answered on January 14, 2011 at 11:23 PM

    Something I would try would be to leave the country dropdown in the form, but remove all options other than United States from your code. Your resulting code would look like this:

    <td><span class="form-sub-label-container"><select class="form-dropdown validate[required] form-address-country" name="q5_address5[country]" id="input_5_country">

    <option selected="selected" value="United States"> United States </option>

    </select><label class="form-sub-label" for="input_5_country" id="sublabel_country"> Country </label></span></td>

     

    Good luck

  • Profile Image
    aytekin
    Answered on January 15, 2011 at 05:29 AM

    You should probably not use the address field, but instead create your own address questions. Add questions "Address", "City", "State" and "Zip", and use Shrink feature to make tem look similar.

  • Profile Image
    adamdurbridge
    Answered on February 09, 2012 at 11:48 AM

    Would it not be better practise to simply have a preference tick-box for 'include country drop down', so that people who aren't interested in nation can use the address for minus the country option?

  • Profile Image
    abajan
    Answered on February 09, 2012 at 12:56 PM

    Yes, you're correct adamdurbridge but for the time being injected CSS can be used to remove the "Country" field. If you have a look at the source of the form pictured below (click the image) you'll see the following injected CSS:

    .form-address-table tbody
    tr + tr + tr + tr td + td {
    visibility: hidden;
    }

    If the address is going to be set to required as above, you must select "United States" (or whichever country for which the form is intended to be used exclusively) as the default country, via the "Country" button in the toolbar.

  • Profile Image
    adamdurbridge
    Answered on February 09, 2012 at 02:05 PM

    Bingo. Many thanks abajan!

  • Profile Image
    abajan
    Answered on February 09, 2012 at 04:55 PM

    You're quite welcome.

    Incidentally, it's also possible to remove the "Country" field from email alerts. Our user guide article titled How to Strip Headers from Postal Addresses in Email Alerts explains the process. Following the example in the article, if an address field's tag is {homeAddress}, that would mean the tag for the "Country" element of that field would be {homeAddress:country}. So, it would simply be a matter of not including that tag in the email alert (notification or autoresponse, as the case may be). The form's submission records will still show the "Country" element though.