Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 176419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:52:25+00:00 2026-05-11T13:52:25+00:00

this may seem trivial but I’m setting up, on a profile form page I’m

  • 0

this may seem trivial but I’m setting up, on a profile form page I’m building, a countries and states select box such that when you select the US or Canada then the states box would display states of the selected countries else it would display a None Applicable instead. My countries and states are in a database and I’m populating m y selects from that – I would like a simple yet proper way to do this – I noticed that for some reason disabling select options is not supported in all browsers 🙁 – or is there any nice free snippet online I could use [maybe I’m feeling too lazy to code this here]

I’m using JQuery for the javascripting here though.


Edited

Thanks for the replies – the cascading drop down seems to do what I need but I’m looking for a php based solution.

How have mainstream websites accomplished this btw. Because I don’t want to leave it to the user and end with entries including American/ Canadian states with countries that are not the US/Canada.


The Ajax idea is what I had in mind but the thing is that the application form I’m building has a section where you can add contact addresses. Its been built such that you can add multiple addresses to the same contact. Theres an add button which just duplicates the address inputs using a javascript function so basically when you submit the form you have data like :

_POST[‘address[]’], _POST[‘city[]’], _POST[‘state[]’],_POST[‘country[]’]

The thing is binding this action to each instance of state and countries when created.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T13:52:25+00:00Added an answer on May 11, 2026 at 1:52 pm

    I think I would not even show the state selector, if neither US nor Canada has been selected from the country selector. This approach has two advantages, users from all other countries are not bothered by meaningless content, you don’t have to deal with unwanted input.

    Now I would save the value of the country selector via AJAX and then send/activate the additional selector div with the response, if needed.

    After your edit: How flexible are you then? If you are stuck with some existing code then a cron job which eliminates unnecessary state entries might be another way.

    I mean you could also handle the state later on retrieval but I assume there is also preexisting code which creates addresses and that code doesn’t check if the state makes sense…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may seem a trivial question, but it's one that's bothered me a lot
This question may seem trivial, but I hope you won't ignore it. Before destroying
This may be something common and trivial, but I seem to be having trouble
This may seem trivial, but I can't figure it out how to 1) retrieve
this may seem trivial but i can't figure out why DNN reports this error,
This may seem trivial for most people but I am getting problems in determining
This may seem trivial, but i'm working on a project to be deployed exclusively
This may seem kind of homework-ish and/or trivial, but it is for a real
This may seem trivial but every example I've ever seen of ADO.net almost always
This one may seem trivial to some, but I'm trying to adopt good habits

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.