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

  • SEARCH
  • Home
  • 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 8787137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:48:38+00:00 2026-06-13T21:48:38+00:00

I have a select field that have have present options and I have a

  • 0

I have a select field that have have present options and I have a php script check a mysql database and add a select tag to the one currently being used.

I need to find a way to know if the user have changed the select field or not before submitting it.

var Access = document.forms[UIDF]["Access"].value;
var DAccess = document.forms[UIDF]["Access"].defaultIndex; <--- This is my problem. I just need to know how to get the selected option value as this keep changing with every user

<select name="Access">
  <option value="0" selected='selected'>Employee</option>
  <option value="1">Team Leader</option>
  <option value="2">Admin</option>
</select>
  • 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. Editorial Team
    Editorial Team
    2026-06-13T21:48:40+00:00Added an answer on June 13, 2026 at 9:48 pm

    The Option tag has a javascript attribute defaultSelected that’s set to true if the option had a selected value on page load. Note that this is the option tag and not the select one, so you’ll have to loop through the options and check for the attribute.

    Something like

    var DAccess;
    var AccessSelect = document.forms[UIDF]["Access"];
    
    for (var i = 0 ; i<AccessSelect.length ; i++)
    {
        if (AccessSelect[i].defaultSelected)
            DAccess = AccessSelect[i].value;
    }
    

    Or, more to the point:

    var AccessHasChanged = false;
    var AccessSelect = document.forms[UIDF]["Access"];
    
    for (var i = 0 ; i<AccessSelect.length ; i++)
    {
        if (AccessSelect[i].defaultSelected && 
            AccessSelect.value != AccessSelect[i].value)
            AccessHasChanged = true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a select-case that will read a name field from a recordset,
Currently I have a select tag with various options for the State in a
I have my database field named tag_info in it I will have data that
I have the following select field and based on whether the class .show-x-trend or
I have a AS400 datasource. I want to union a select field. This union
I have 6 different select boxes and a text field which I need to
I have a html element (like select box input field) in a table. Now
I have to create a field where I will be able to select between
I have an hidden input field with a value, <form> <input type=hidden value=product/> <select
I have capture change event on drop down select. This drop down field is

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.