title: How to edit a record from a list view using backbone Js
body: <p>This is an EDIT to what i had posted earlier. I tired out few things suggested in this post. i think im close to getting it, but needs some more tweak.</p>
  <p>I am looking to edit  a record from my list:This is how my view is designed:</p>
  <pre><code>var EditSubAccount = Backbone.View.extend({
       render: function(id,options){  
              var self= this; 
              
                  var subaccount = new SubAccountModel([],{id: this.options});
                  subaccount.fetch({
                      
                      success: function(subaccount){
                          var d = subaccount.toJSON();
                          var user = d.data.items;
                         //user gives the Json o/p as shown below
                          var template = $(&quot;#sub-account-list&quot;).html(_.template(edittmpl, {user:user}));
                          
                      
                  })
              }
  </code></pre>
  <p>Here the <code>user</code> gives the Json object as follows:</p>
  <pre><code>[
   {
      accountType: &quot;Customer&quot;
      active: true
      name: account 1
      id: 87384738
      billingContactInfo: 
      {
         address1: &quot;1234 asdf&quot;
         address2: &quot;&quot;
         city: &quot;mountain view&quot;
       }
     }
   ]
  </code></pre>
  <p>and my html:</p>
  <pre><code>&lt;form class=&quot;edit-form&quot; method=&quot;PUT&quot; &gt;
          &lt;table&gt;
              &lt;tbody&gt;
  
          &lt;tr&gt;
         &lt;td&gt; &lt;input type = &quot;text&quot;class=&quot;name&quot; value= &quot;&lt;%= user ? user.name : '' %&gt;&quot; /&gt;&lt;/td&gt;
       &lt;!-- get undefined when on `user.name` --&gt;
      &lt;/tr&gt;
  
      &lt;/tbody&gt;
      &lt;/table&gt;
      &lt;% if (subaccount){ %&gt;
  
      &lt;input type=&quot;hidden&quot; value = &quot;&lt;%= user.id %&gt;&quot; /&gt;
  
      &lt;% } %&gt;
       
          &lt;button class=&quot;save&quot; method=&quot;PUT&quot;&gt;Save&lt;/button&gt;
          &lt;button class=&quot;cancel&quot;&gt;Cancel&lt;/button&gt;
      &lt;/form&gt;
  </code></pre>
  <p>and my router where im initializing the Editaccount:</p>
  <pre><code>var AppRouter = Backbone.Router.extend({
    routes: {
        'edit/:id' : 'editSubAccount',
  }
    editSubAccount: function(id){
     var editsubaccount = new EditSubAccount(id); 
          editsubaccount.render({id:id});
    }
    
    });
  </code></pre>
  <p>When i try click the edit link it does display the correct 'id' i need to edit, but the form displays blank instead populating with the fields. below is how my list looks like:
  <img src="https://i.stack.imgur.com/kjt3Z.png" alt="enter image description here" /></p>
  <p>I am not sure what im missing in this. Please anyone any ideas?</p>