ONLY WANT US STATES TO DISPLAY IN FORM DROP DOWN

Options
Dear Blackbaud,


I cannot believe you do not have the ability to limit or select a table of "states" based on the country. I only need US states for my alumni registration forms. I would not like Canada or US army bases to show as options in the drop down field of choices for NetCommunity forms. Can you please develop a fix for this?


Thank you,

Erin Bolton
Tagged:

Comments

  • Erin Bolton:

    Dear Blackbaud,


    I cannot believe you do not have the ability to limit or select a table of "states" based on the country. I only need US states for my alumni registration forms. I would not like Canada or US army bases to show as options in the drop down field of choices for NetCommunity forms. Can you please develop a fix for this?


    Thank you,

    Erin Bolton

    Hey Erin,


    We just implemented new features from the idea bank into BBNC -- this would be an idea for the product management team to review. Would you mind posting it in their idea bank?

    https://community.blackbaud.com/products/netcommunity/ideas


    Thanks!

  • Erin Bolton:

    Dear Blackbaud,


    I cannot believe you do not have the ability to limit or select a table of "states" based on the country. I only need US states for my alumni registration forms. I would not like Canada or US army bases to show as options in the drop down field of choices for NetCommunity forms. Can you please develop a fix for this?


    Thank you,

    Erin Bolton

    Hello Erin, 


    This can be easily accomplished using basic JS to remove specific options within the dropdown menu for states. Please include a link to a page with the dropdown, and I am happy to provide the JS to resolve this issue. Ideas submitted to the NetCommunity Ideas forum never will be implemented, so I am happy to help you myself.


    - Chris

  • Thanks so much Chris for your solution. Can
    you tell me what you mean by link to a page?

     

    Thanks,

    Erin

     

     

    Erin
    Bolton

    Development
    Coordinator

    Office
    of Institutional Advancement

     


     

    1750
    Independence Ave, Kansas City, MO 64106

    t.
    816-654-7291

    f.
    816-654-7281

     

    Find
    KCU on
      

     

     

  • I need the link to your alumni registration form.


    Thank you,


    Chris
  • https://2300.thankyou4caring.org/homecoming2017

     

    You don’t know how grateful I am. I did
    manually move all the US states and DC to the top of my States
    table as my current fix.

     

    Erin

  • Erin Bolton:

    https://2300.thankyou4caring.org/homecoming2017

     

    You don’t know how grateful I am. I did manually move all the US states and DC to the top of my States table as my current fix.

     

    Erin

     

    Hello Erin,


    I'm always happy to help other non-profits. I made an example of the script working on a test page of my organizations NetCommunity.

    You can view the example here: https://ctsciencecenter.thankyou4caring.org/dev/state-test


    You will want to create an unformatted text part, and select for the content to appear before the closing body tag.

    9dd606a3d8c25b2cc7795c734a28b482-huge-bh


    Then you want to enter the the following script:

     


    $(document).ready(function(){
        $('[id*="StateUS"] > option').each(function() {
          var states = ["AL", "AK", "AS", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FM", "FL", "GA", "GU", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MH", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "MP", "OH", "OK", "OR", "PW", "PA", "PR", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VI", "VA", "WA", "WV", "WI", "WY"];
          if($.inArray($(this).text(), states ) === -1){
          $(this).remove();
          }
        });
    });



    Here's a breakdown of what the script does:


    1.) It locates the dropdown select box via a wildcard on the ID attribute.

    2.) It then compares each option to an array of states that you want to include. Feel free to edit the array as necessary.

    3.) If an option does not match an array option, it will delete the option from the select dropdown.


    Please let me know if you have questions with implementation / the script itself.


    Good Luck!

    - Chris McGrane

     


  • Hi Chris,


     


    Thank you! I’ll have to have someone versed in JS to help me insert
    it. This is all new to me. Have a great weekend.


     


    Erin


     





  • Erin Bolton:

    Hi Chris,

     

    Thank you! I’ll have to have someone versed in JS to help me insert it. This is all new to me. Have a great weekend.

     

    Erin

     


     


     

    Not a problem! Have a nice weekend!


    - Chris

Categories