Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

142
Views
Select fields not displaying proper values in Bootstrap modal dialog

Using Bootstrap v5.x modal dialog to handle a mailing address update form.

When the page loads, the value= arguments for the <input> fields in my modal dialog are assigned using PHP. There are 2 <select> fields, one for the state, the other for the country. These both have their <option> lists provided by PHP as well. So all this information is pre-loaded into the modal's fields before the modal is ever shown.

The <input> fields display properly. However, the <select> fields do not display the <option> value having the selected argument set. When examining the HTML, the selected argument is indeed set on the correct value for each field, but BS appears to somehow override these being displayed when the modal is shown. It's as if the selected argument was not set at all.

So is this a bug with BS5? Or is it something I'm missing? Is there a workaround JS command I need to run after the modal is shown to refresh the <select> fields so they will display the selected values?

enter image description here

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!