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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:33:13+00:00 2026-06-14T11:33:13+00:00

My textboxes look something like this at the moment, @Html.TextBox(Something, , new { type

  • 0

My textboxes look something like this at the moment,

 @Html.TextBox("Something", "", new
       {                           
          type = "text",
          min = 1,
          max = 60,
          data_validation_integer_regex = @ValidationPatterns.Integer,
          data_validation_integer_message = @ValidationPatterns.IntegerMessage,
          data_bind = "value: observables.Something"
        })

Which renders as

   <input data-bind="value: observables.Something" 
          data-validation-integer-message="Some message" 
          data-validation-integer-regex="^[1-9]\d*$" 
          id="Something" 
          max="60" 
          min="1" 
          name="Something" 
          type="text" 
          value="">

The validation library we’re using jqBootstrapValidation

I’d like to make some of my fields required, and the way to do so using this library, I’d need to add a tag to the input field like so

<input id="Something" ... required >

Razor doesn’t allow me to do this though, as it seems to want all parameters in this format

property="something" or property=100

is my only option reverting to standard html markup if i want to make my fields required?

  • 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-14T11:33:14+00:00Added an answer on June 14, 2026 at 11:33 am

    If you use a property with an empty string (required=""), then Razor will render it as a valueless attribute. That is,

    @Html.TextBox("name", "value", new { attr="something", required="" })
    

    Renders as:

    <input type='text' name='name' id='id' value='value' attr='something' required />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an if statement that needs to look like this: UPDATE $(input#textbox).keypress(function(e){ key==e.which;
I have a string, which could look like this: Sandra <as type=1>walked</as> in the
In my ListView I have an ItemTemplate and EditItemTemplate which look something like this,
Lets say I have a custom data type that looks something like this: public
I'm trying to iterate through each line of a multiline textbox. Something like: For
I have a UI kit something like the on this link . And I
When I look at gmail on my mobile web browser the password textbox hashes
I have several textboxes where users can enter information into them. This can include
I have a textbox.T he user will be entering entering a number in this
Do any have any experience how this cold be done, if you look at

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.