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 8207939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:10:06+00:00 2026-06-07T09:10:06+00:00

currently im working with a form that on submit uses javascript to validate all

  • 0

currently im working with a form that on submit uses javascript to validate all of the forms input fields and throws errors if a field is incomplete. I have an option though, that when checked will disabled a few of the inputs, and im looking to stop the errors from being thrown if the textbox is disabled.

relevant code includes:

html:

                <select name="os" id="os">
                    <option>-Select-</option> 
                    <option value="A">Android</option> 
                    <option value="I">iOS</option>
                     <option value="W">Windows Mobile</option> 
                 </select> <font color="#CC0000">*</font>

js

if (document.FrontPage_Form1.Action[0].checked==true) 
    {
        var dropvalue = document.getElementById("os");
        var dropText = dropvalue.options[dropvalue.selectedIndex].text;


            if (dropText=="-Select-") && (dropvalue.disabled=false)
            {
                document.getElementById("OS_Msg").style.display='';
                document.getElementById("OS_Err").style.display='';

                valid==false;
            }

    }

jQuery disable

<p><input type="checkbox" name="noPhone" id="noPhone">: My Device does not have a phone number.</p>

<script type="text/javascript">

            $("#noPhone").click(onCheckChange).change(onCheckChange);

                        function onCheckChange() {
                          if ($("#noPhone").is(':checked'))
                          {
                            $("select.focusDrop").attr('disabled', 'disabled');
                            $(":text").attr('disabled', 'disabled');
                          }
                          else
                          {
                            $("select.focusDrop").removeAttr('disabled');
                            $(":text").removeAttr('disabled');
                          } 
                        }

            </script>
  • 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-07T09:10:08+00:00Added an answer on June 7, 2026 at 9:10 am

    Aside from missing a set of parenthesis wrapping around (dropText=="-Select-") && (dropvalue.disabled=false), you’re setting a value instead of comparing it with

    dropvalue.disabled=false
    

    It should be

    dropvalue.disabled==false
    

    And as pointed out by Guffa, valid==false; should be valid=false;

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

Sidebar

Related Questions

Currently I am working on a program that lets me handle data in form
Im currently working on a game that uses multi touch to apply zoom to
I'm currently working on a problem that basically involves processing all data in a
I am currently working on a php/html/javascript project. I have a form where when
I'm currently working on a website that works without any javascript. I'm going to
I'm currently working on a site where I use anchors to submit forms with
Currently working with converting SQLException error messages into messages that are more useful for
I'm working on a jQuery function that forwards form data to page without interfering
I'm currently working on my first Django app, which allows registered users to submit
I am currently working on a building community website in PHP. This contains forms

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.