title: Django and jquery - after .load() form is no longer valid
body: <p>I am using jquery .load() to load a django template into a popup div</p>
  
  <p>the template I am using has a form and when I load the template the form is no long valid, but when I visit the template through the url the form is valid.</p>
  
  <p>Can anyone think of any reason a form would no longer be valid after jquery load?</p>
  
  <p>here is my form:</p>
  
  <pre><code>def createrecipe(request):
      if not request.user.is_authenticated():
          return HttpResponseRedirect('/index/')
      else:
          if request.method == 'POST':
              form = RecipeForm(request.POST)
              if form.is_valid():
                  recipe = form.save(commit=False)
                  recipe.original_cookbook = request.user.cookbooks.all()[0]
                  recipe.pub_date = datetime.datetime.now()
                  recipe.save()
                  user = request.user
                  cookbooks = user.cookbooks
                  cookbook = cookbooks.all()[0]
                  cookbook.recipes.add(recipe)
                  return HttpResponseRedirect('/account')
          else:
              form = RecipeForm()
  
          return render_to_response('cookbook/createrecipe.html',
                                      {'form':form},
                                context_instance=RequestContext(request))
  </code></pre>
  
  <p>here is my form template:</p>
  
  <pre><code>{% block content %}
  &lt;div id="createform"&gt;
  &lt;h1&gt;Create New Recipe&lt;/h1&gt;
      &lt;form action="." method="POST"&gt;
          &lt;table&gt;
              {% csrf_token %}
              {{ form.as_table }}
          &lt;/table&gt;
          &lt;p&gt;&lt;input type="submit" value="Submit"&gt;&lt;/p&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  {% endblock %}
  </code></pre>
  
  <p>here is the load function:</p>
  
  <pre><code>$(document).ready(function(){
      $(".create").on("click", function(){
          $("#popupContact").load("/cookbook/createrecipe #createform");
      });
  });
  </code></pre>
  
  <p>thank you,</p>
  
  <p>snackerfish</p>