locked
How can I have optional sections in my web form? RRS feed

  • Question

  • User-702124402 posted

    Hi,

    I was just wondering how I could implement sections that are optional to a user as they are completing a required form? I'm working on a project and depending on user needs they may need to have the option to select different sections that apply to their request. I'm working with Razor Pages, there could be something that I am missing it would be great if someone could help point me in the right direction!

    Thanks in advance

    Monday, June 8, 2020 11:23 PM

All replies

  • User475983607 posted

    I was just wondering how I could implement sections that are optional to a user as they are completing a required form? I'm working on a project and depending on user needs they may need to have the option to select different sections that apply to their request. I'm working with Razor Pages, there could be something that I am missing it would be great if someone could help point me in the right direction!

    Your question is a general design that cannot be answered by a forum.  Only you know what fields are option and which are not.  However, the framework comes with data annotations applied to model properties which can make a field required.  That might be an option?

    https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/validation?view=aspnetcore-3.1

    Monday, June 8, 2020 11:40 PM
  • User-17257777 posted

    Hi Penney23,

    Can you provide us some codes that can reproduce your scene, and then describe your expected result combine the code.

    Best Regards,

    Jiadong Meng

    Tuesday, June 9, 2020 9:49 AM
  • User-474980206 posted

    The if statement will work

    @if (somecondition) {
       <div>
         .....
       </div>
    }
    

    Tuesday, June 9, 2020 2:39 PM