Remove "state" from address field?

  • Profile Image
    cdresor
    Asked on March 04, 2012 at 11:11 AM

    ...since state/province is not used in Swedish addresses :-)

  • Profile Image
    pinoytech
    Answered on March 04, 2012 at 11:48 AM

    Hi,

    In order for you to remove state/province in your address field:

    1. Edit your form

    2. Click Setup & Embed

    3. Click Embed Form

    4. Edit your source code using notepad or wordpad

    5. Find this code and remove it from your source code of your form

    <td><span class="form-sub-label-container"><input class="form-textbox form-address-state" type="text" name="q19_address19[state]" id="input_19_state" size="22" />

                      <label class="form-sub-label" for="input_19_state" id="sublabel_state"> State / Province </label></span>

                  </td>


    Hope you find this information helpful and informative. Thank you for using JotForm!

  • Profile Image
    abajan
    Answered on March 04, 2012 at 11:56 AM

    With due respect to pinoytech, there's no need to edit the form's source, unless it is imperative that an empty "State" field not be displayed in the submission records. Injecting the following CSS and substituting the correct element IDs in the selector should suffice:

    #input_1_state,
    #sublabel_state {
    display: none;
    }

    Also see Remove country option from Address Block where a different injected CSS route (a combination of descendant and adjacent sibling selectors) was taken to achieve a similar goal.

    With each method, the job of determining the appropriate selector to use is made much easier with Firebug.

  • Profile Image
    abajan
    Answered on March 04, 2012 at 12:18 PM

    Incidentally, I forgot to mention that it's now easier to find out a field's ID by right-clicking the field in the form builder and clicking Show Properties:

    (Click image to zoom)

    (Alternatively, click the field then its Properties icon)

    Since the Address element is comprised of several fields (a "compound field", if you will) there will be more than one ID displayed in the details section.

  • Profile Image
    cdresor
    Answered on March 04, 2012 at 01:09 PM

    Thanks for all the answers. Apart from these excellent suggestions/answers, I am deeply impressed by the forum and the product itself!

  • Profile Image
    maisongibert
    Answered on October 02, 2012 at 04:51 PM

    Hi everyone, so what is the right step to remove this "state" field ?
    Thanks  alot!

  • Profile Image
    EduardoMendez
    Answered on October 02, 2012 at 07:08 PM

    @maisongibert

    You can do this by injecting CSS (please follow this guide)

    #input_1_state,
    #sublabel_state {
    display: none;
    }

     

    Where #input_1_state and #sublabel_state are the IDs for the State field and the label.

    To find the Ids for the fields on your form, as my colleague mentioned, you can check the properties by right clicking and chossing the option of: Show Properties:

    (Click image to zoom)

    Since the Address element is comprised of several fields (a "compound field", if you will) there will be more than one ID displayed in the details section.

    Give it a try and let us know if you need further assistance!