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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:46:08+00:00 2026-05-27T09:46:08+00:00

I have two fields on an MVC3 form that must represent the same value.

  • 0

I have two fields on an MVC3 form that must represent the same value. If one is updated it should update the other and display the correct value (Gotta love requirements). For what may be obvious reasons, the field (with the second one on the page) does not update properly. Is there a way to achieve what I need?

For example:

First Example

 <li class="identifier-controls"            @Model.IdentifierConfigurator.GenerateDataAttributes("ssn")>
        @Html.TextFieldFor("Social Security Number", m => m.SocialSecurityNumber).SSN()
    </li>

may appear twice on that form (In two different spots). (At this point, both of the controls have the same ID and name)

OR:

Second Example

    <li class="identifier-controls"            @Model.IdentifierConfigurator.GenerateDataAttributes("ssn")>
       @Html.TextFieldFor("Social Security Number", m => m.SocialSecurityNumber).SSN()
    </li>

and

    <li class="identifier-controls"            @Model.IdentifierConfigurator.GenerateDataAttributes("ssn")>
       @Html.TextFieldFor("Social Security Number", m => m.Person.Description.SSN).SSN()
    </li>

will appear on the form. At this point the IDs are different for the input but it will only update on of them.

Here is the HTML that is generated:

<ol class="field-list display">

  <li id="party-name"><span class="label">Name</span><span id="FormalDisplayName" class="value" style="width:140px">Guy, Bad</span></li>

  <li><span class="label">Aliases</span><span id="AliasNames" class="notentered" style="width:140px">Not entered</span></li>

  <li><span class="label">Status</span><span id="PartyStatusName" class="notentered" style="width:140px">Not entered</span></li>

  <li><span class="label">Gender</span><span id="Description_Gender" class="notentered" style="width:140px">Not entered</span></li>

  <li><span class="label">Juvenile</span><span id="Description_IsJuvenile" class="value" style="width:140px">No</span></li>

  <li><span class="label">Ethnicity</span><span id="Description_Ethnicity" class="notentered" style="width:140px">Not entered</span></li>

  <li><span class="label">Residential Status</span><span id="Description_ResidentialStatus" class="notentered" style="width:140px">Not entered</span></li>

  <li><span class="label">Marital Status</span><span id="Description_MaritalStatus" class="notentered" style="width:140px">Not entered</span></li>

  <li><span class="label">Religion</span><span id="Description_Religion" class="notentered" style="width:140px">Not entered</span></li>

  <li><span class="label">Citizenship</span><span id="Description_Citizenship" class="notentered" style="width:140px">Not entered</span></li>

  <li><span class="label">Birth City</span><span id="Description_BirthCity" class="notentered" style="width:140px">Not entered</span></li>

  <li><span class="label">Date of Birth</span><span id="Description_BirthDate" class="notentered" style="width:140px">Not entered</span></li>

  <li><span class="label">Date of Death</span><span id="Description_DeathDate" class="notentered" style="width:140px">Not entered</span></li>

  <li><span class="label">Est. Age at Incident</span><span id="Description_EstimatedAgeAtIncident" class="notentered" style="width:140px">Not entered</span></li>

  <li><span class="label">Adoption Date</span><span id="Description_AdoptionDate" class="notentered" style="width:140px">Not entered</span></li>

  <li><span class="label">Multiple Birth</span><span id="Description_MultipleBirthName" class="notentered" style="width:140px">Not entered</span></li>

  <li><span class="label">Email</span><span id="Description_Email" class="notentered" style="width:140px">Not entered</span></li>



    <li><span class="label">Identifiers</span><span id="SuspectIdentifiersDisplay" class="value" style="width:400px">Prof<span class='value-display'>&nbsp;123</span><span class='separator'>&nbsp;|&nbsp;</span>FBI<span class='value-display'>&nbsp;123</span><span class='separator'>&nbsp;|&nbsp;</span>SSN<span class='value-display'>&nbsp;222-22-2222</span><span class='separator'>&nbsp;|&nbsp;</span>ITN<span class='value-display'>&nbsp;123</span><span class='separator'>&nbsp;|&nbsp;</span>BCI<span class='value-display'>&nbsp;13</span><span class='separator'>&nbsp;|&nbsp;</span>ID<span class='value-display'>&nbsp;123</span><span class='separator'>&nbsp;|&nbsp;</span>DL<span class='value-display'>&nbsp;123</span><span class='separator'>&nbsp;|&nbsp;</span></span></li>

</ol>

The only difference between this HTML (this is the html from example two) and the HTML that is generated in the first example is that the two controls have the same ID and name. Here is what happens in the controller method that is called by the BeginRouteForm html helper when submit is called:

public ActionResult Update(int partyId, FormCollection data)
{
var party = Party.Find(partyId).OrNotFound();
var vm = new PartyEditViewModel(party.Case, party);

  try
  {
    UpdateModel(vm, data);

    return JsView("Update.js", party);
  }
  catch (UpdateModelException)
  {
    return JsView("Edit.js", vm);
  }
}
  • 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-27T09:46:08+00:00Added an answer on May 27, 2026 at 9:46 am

    ok it looks like what is causing the issue is that your calls to Html.TextFieldFor may be creating two controls with the same name and Id that bound to to seperate model properties. If this is the case you will need to correctly prefix the id and name of the controls so that when model binding kicks in, it will bind the values correctly against the model’s properties.

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

Sidebar

Related Questions

I have two fields that need to multiply each other and fill a third
I have two fields... one is category name and other is document title... When
I have two fields that are of the same type in my property-grid. However,
I have two fields that a user will fill in, one is a begin
I have two email fields on a form to validate that the user entered
I have two fields, one is just the number of the other one, e.g.
I have two fields in a table. One contains values such as BTA, BEA,
I have a basic ActiveRecord model in which i have two fields that i
I hope I can explain this right I have two input fields that require
I have two fields that are of type int lap_time_1 and lap_time_2 . Is

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.