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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:32:42+00:00 2026-06-03T07:32:42+00:00

I am using a strongly typed model for my view. I have a disabled

  • 0

I am using a strongly typed model for my view. I have a disabled text box whose value I update using javascript. The textbox is rendered using this

<%: Html.TextBoxFor(model => model.TotalAmount, new { disabled = "disabled"})%>

This renders a textbox with NAME and ID as ‘TotalAmount’. TotalAmount is also a property on my model that binds to this view.

The javascript to update its value in the view is like this within its function:

document.getElementById('TotalAmount').value = {assigning new value here};

The function does get called and I can see the value in the disabled textbox when I change some value in another editable textbox. However, when I post this form to my action method as below :

[HttpPost]
public ActionResult Process (ProcessVM FormPostVM)
{
}

the disabled textbox property [TotalAmount] still has the old value but the editable textbox which I modified contains the new value I entered. Why does the disabled textbox not contain the javascript updated value?

I tried using

ModelState.Remove("TotalAmount");

in the action method above, but as I already figured it didn’t work.

Any clues, tips?

Thanks for your time….

  • 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-03T07:32:44+00:00Added an answer on June 3, 2026 at 7:32 am

    HTML input elements such as textboxes that have the disabled="disabled" attribute will never send their values to the server when the form is submitted. If you want to send the value to the server while still disabling the user from changing it you could make the textbox readonly:

    <%= Html.TextBoxFor(model => model.TotalAmount, new { @readonly = "readonly" }) %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strongly-typed view with a @model declaration: @model MyViewModel When using extension
I have a PartialView strongly typed to a view model <%@ Control Language=C# Inherits=System.Web.Mvc.ViewUserControl<VATRateManager_MVC.Models.ViewModels.RateControlEditViewModel>
Using EF4 Codefirst RC and MVC .NET I have a Strongly typed view I
I have a strongly-typed view, with a list of custom objects in the model.
I have a strongly typed View that accepts a Customer model, this customer model
I have a strongly typed view, Edit, with a model named OrderModel. In this
I have a Search Edit view which is strongly typed to my Search model
I have a strongly typed view that is using a viewmodel I created. I
I have a view tied to a strongly typed ViewModel but I'm not using
I have a view that is strongly typed: <%@ Page Title= Language=C# MasterPageFile=~/Views/Shared/Site.Master Inherits=System.Web.Mvc.ViewPage<MPKwithMVC.Models.SmartFormViewModel>

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.