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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:17:13+00:00 2026-05-26T11:17:13+00:00

I have a form that has a field (Field A) that needs to be

  • 0

I have a form that has a field (Field A) that needs to be empty if Option 1 is selected on a dropdown, and is required if Option 2 is selected. I have some javascript that clears and disables the Field A when Option 1 is selected.

I have Simon Ince’s RequiredIf attribute applied to Field A in the model, dependant on Option 1, and it works well. That’s not the problem.

Here’s the sequence of events that does cause a problem:

  1. User has Option 2 selected (so that field A is required) and Field A empty.
  2. User clicks on Save. Validation message appears by field A and in the validation summary. All is well.
  3. User changes to Option 1. Field A becomes disabled.
  4. User clicks on Save. Validation message remains by Field A but does not appear in the Validation Summary.

I conclude from this that the RequiredIf validation is working (and Field A is passing validation), but the old validation message is sticking around. Which I do not want.

All this is client-side, by the way.

If the field isn’t disabled, everything works as expected, but I’d like it disabled rather than editable but “required to be empty”.

Other than clear out the message SPAN tag through js and jQuery, is there a way to fix this?

  • 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-05-26T11:17:14+00:00Added an answer on May 26, 2026 at 11:17 am

    Because the validation requirements are changing, you need to cause validation to occur, and then update all of the error messages. Since the issue relates to the change of the selected item on the dropdownlist, add the following:

    $("#myDropDown").live("change", function() { // assumes dropdownlist has id of 'myDropDown'
        $("form").validate().form(); // form() causes error messages to update
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that has a field that needs to be rendered as
I have a field in a CCK node form that is hidden, and has
I have a form that has a series of check boxes and some line
I have a form that needs to be validated only after it has been
I have a form that has a group of 3 text_fields. I need two
I have a form that has multiple fields, and for testing purposes is there
I have an online form that has a few fields with time data. I
We have a very long form that has a number of fields and 2
I have a form that has a public property public bool cancelSearch = false;
I have a form that has a few similar controls and the parent contains

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.