title: Laravel - Return with input from a dynamic select menu after validation error
body: <p>I have a couple of select menus that are populated dynamically by selecting an option from another menu.</p>
  
  <p>because these are populated dynamically, Laravel's withInput function does not return the data that was selected if the form does not pass validation.</p>
  
  <p>Is there a way to return Input from dynamically created field data?</p>
  
  <p>Here is my java script that builds the select menu</p>
  
  <pre><code>$('.admin-select').change(function() {
  
      $.getJSON("/locations/getlocationslist/"+$(this).val(), function(data) {
  
          var location = $('#location');
          location.empty();
  
          $.each(data, function(index, element) {
              location.append("&lt;option value='"+ element.id +"'&gt;" + element.name + "&lt;/option&gt;");
          });
          $.one(location.prepend("&lt;option&gt;- Select -&lt;/option&gt;"));
  
      });
  });
  </code></pre>
  
  <p>This is the function that gets the data for the menu:</p>
  
  <pre><code>public function getlocationslist($id)
  {
      $company = Company::find($id); 
      $locations = $company-&gt;locations();
      return Response::make($locations-&gt;get(['id','name']));
  }
  </code></pre>
  
  <p>In my users controllers store function I check validation:</p>
  
  <pre><code>$this-&gt;userNewForm-&gt;validate(Input::all());
  </code></pre>
  
  <p>Then the error handler:</p>
  
  <pre><code>App::error(function(Laracasts\Validation\FormValidationException $exception, $code)
  {
  return Redirect::back()-&gt;withInput()-&gt;withErrors($exception-&gt;getErrors());
  });
  </code></pre>