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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:19:35+00:00 2026-05-25T03:19:35+00:00

Scenario: The user should fill out a form and based on his choices different

  • 0

Scenario: The user should fill out a form and based on his choices different properties are displayed(using jquery .show and .hide).
Problem: I want some of those properties that are shown to be required(but only when they are shown ofc). The [Required] attribute doesn’t care if the property is shown or not. So if I use [Required] the user are asked to fill out properties he can’t see.
Solution: ?

  • 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-25T03:19:36+00:00Added an answer on May 25, 2026 at 3:19 am

    You could use the RequiredIf attribute to perform conditional validation:

    [RequiredIf("HiddenFoo", "true", ErrorMessage = "Foo is required")]
    public string Foo { get; set; }
    
    public string HiddenFoo { get; set; }
    

    Now, add a hidden field called HiddenFoo and then toggle its value when you are showing/hiding the Foo textbox. Foo will be required only if HiddenFoo="true".

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

Sidebar

Related Questions

Here is my scenario. User fills out this large page which is dynamically created
I'm using Devise for user Authentication and have the following failing Cucumber scenario: Scenario:
In my scenario, the end user customizes his or her user interface by breaking
The title should be pretty clear, but consider this scenario: User bobbyflay registers an
Scenario: In an e-commerce system, a helpdesk user should be able to impersonate or
.Net Compact Framework Scenario: User is on a screen. Device can't finds a printer
This is the standard scenario: User registers on the site User receives an account
I have a scenario where a user will have access to a one-time-url. When
I have a scenario where a user is emailing another user in an HTML
Here's the scenario: if this is a user's first time logging into my web

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.