title: Set a value in Model via javascript
body: <p>I have this code:</p>
  
  <pre><code>public class AccountModel
  {
      [Required]
      [Display(Name = "Subscription ID")]
      public string SubscriptionId { get; set; }
  
      [Required]
      [Display(Name = "Storage Name")]
      public string StorageName { get; set; }
  
      [Required]
      [Display(Name = "Storage Key")]
      public string StorageKey { get; set; }
  
      [Required]
      [Display(Name = "Hosted Name")]
      public string HostedName { get; set; }
  ....
  }
  </code></pre>
  
  <p>and...</p>
  
  <pre><code>$('a.sign-in').live('click', function () {
              alert("BINGO!");
  
              var id = document.getElementById('id').value;
              var name = document.getElementById('name').value;
              var key = document.getElementById('key').value;
              var select = document.getElementById("listahosted");
              var selected = select.options[select.selectedIndex].text;
  ...
  }
  </code></pre>
  
  <p>I just want to set a value on my model -> put the "selected" value in the model m.HostedName
  How can I do this?</p>
  
  <p>Regards</p>
  
  <p>UPDATE WITH MY VIEW</p>
  
  <p>My view</p>
  
  <pre><code>@model WebManager.Models.AccountModel
  @{
      ViewBag.Title = "Account";
  }
  
  &lt;h2&gt;Account&lt;/h2&gt;
  &lt;p&gt;
  Please enter your Azure account details.
  &lt;/p&gt;
  
  @Html.ValidationSummary(true, "Invalid account. Please correct the errors and try again.")
  
  @using (Html.BeginForm())
  {
  &lt;div&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;Account Information&lt;/legend&gt;
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(m =&gt; m.SubscriptionId)
          &lt;/div&gt;
         &lt;div class="editor-field"&gt;
              @Html.TextBoxFor(m =&gt; m.SubscriptionId, new { id = "id"})
              @Html.ValidationMessageFor(m =&gt; m.SubscriptionId)
          &lt;/div&gt;
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(m =&gt; m.StorageName)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.TextBoxFor(m =&gt; m.StorageName, new { id = "name" })
              @Html.ValidationMessageFor(m =&gt; m.StorageName)
          &lt;/div&gt;
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(m =&gt; m.StorageKey)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.TextBoxFor(m =&gt; m.StorageKey, new { id = "key" })
              @Html.ValidationMessageFor(m =&gt; m.StorageKey)
          &lt;/div&gt;
  
          &lt;p&gt;
              &lt;a href="#login-box" class="login-window"&gt;
                  &lt;input type="submit" value="Apply" /&gt;&lt;/a&gt;
          &lt;/p&gt;
      &lt;/fieldset&gt;
  &lt;/div&gt;
  
  &lt;div id="login-box" class="login-popup"&gt;
      &lt;!--a href="#" class="close"&gt;&lt;img src="close_pop.png" class="btn_close" title="Close Window" alt="Close" /&gt;&lt;/a--&gt;
      &lt;form method="post" class="signin" action="#"&gt;
      &lt;fieldset class="textbox"&gt;
          &lt;label class="hostedservice"&gt;
              &lt;span&gt;Hosted Service&lt;/span&gt;
              &lt;br /&gt;
              &lt;select id='listahosted' name='listahosted'&gt;
              &lt;option&gt;Choose your hosted&lt;/option&gt;
              &lt;/select&gt;
          &lt;/label&gt;
          &lt;br /&gt;
          &lt;label class="deployments"&gt;
              &lt;span&gt;Role&lt;/span&gt;
              &lt;br /&gt;
              &lt;select id='listadeployments' name='listadeployments'&gt;
              &lt;option&gt;Choose your role&lt;/option&gt;
              &lt;/select&gt;
          &lt;/label&gt;
          &lt;br /&gt;
          &lt;a class="sign-in"&gt;
          &lt;input type="submit" value="Sign In" /&gt;&lt;/a&gt;
      &lt;/fieldset&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I am not putting here the javascript.</p>
  
  <p>The situation is: I have a combobox filled by JS and I need to put the selected value on my model.</p>
  
  <p>All help is apreciated</p>