Hello, I am loading a html snippet by using dialog and then loading this html snippet via xhr call into the dialog. I need to have javascript on this modal window also, because I am displaying a form on this page. The source of the page should be that:
{% load i18n %} <form action="{{ request.path }}?ajax=True" method="post" id="xhr-task- form"> <h2>{% trans 'Add a task' %}</h2> <div class="form_field{% if field.errors %} error{% endif %}"> {{ form.name.label_tag }}{% if form.name.field.required %}*{% endif %}<br /> {% if form.name.help_text %} <span class="quiet">{{ form.name.help_text }}</span><br /> {% endif %} {{ form.name }} {{ form.name.errors }} </div> <script type="text/javascript"> document.getElementById('{{ form.name.auto_id }}').focus(); </script> <div class="form_field{% if field.errors %} error{% endif %}"> {{ form.description.label_tag }}{% if form.description.field.required %}*{% endif %}<br /> {% if form.description.help_text %} <span class="quiet">{{ form.description.help_text }}</span><br /> {% endif %} {{ form.description }} {{ form.description.errors }} </div> <div class="form_field{% if field.errors %} error{% endif %}"> {{ effort_form.effort.label_tag }}{% if effort_form.effort.field.required %}*{% endif %}<br /> {% if effort_form.effort.help_text %} <span class="quiet">{{ effort_form.effort.help_text }}</span><br /> {% endif %} {{ effort_form.effort }} {{ effort_form.effort.errors }} </div> <input id="form-submit" type="submit" value="{% trans 'save' %}"> <input type="hidden" id="id_w-effort" name="w-effort" value="0" /> </form> <script type="text/javascript"> $('form-submit').click(function(){ var name = $('{{ form.name.auto_id }}').val(); if (name == '') { $('{{ form.name.auto_id }}').addClass('error'); return false; } var effort = $('{{ effort_form.effort.auto_id }}').val(); if (effort == ''){ $('{{ effort_form.effort.auto_id }}').addClass('error'); return false; } $.ajax({ type: 'POST', url: $('#xhr-task-form').attr('action') }); // prevent the submit button to submit the form return false; }); </script> but it returns as that: <div id="task-form-container" class="ui-dialog-content ui-widget- content" style="width: auto; min-height: 92px; height: 542px; "> <form action="/product/1/2010-09-06-uthis-is-the-next-sprint/33/task/ add/?ajax=True" method="post" id="xhr-task-form"><div style="display:none;"><input type="hidden" id="csrfmiddlewaretoken" name="csrfmiddlewaretoken" value="033e6a5f0c42370729735f0f420c531d"></ div> <h2>Add a task</h2> <div class="form_field"> <label for="id_name">Name</label>*<br> <input id="id_name" type="text" class="title" name="name"> </div> <div class="form_field"> <label for="id_description">Description</label><br> <textarea id="id_description" rows="10" cols="40" name="description"></textarea> </div> <div class="form_field"> <label for="id_e-effort">Hours open</label>*<br> <span class="quiet">Hours open until the task is done. (Valid formats are: 1.25 or 1:15)</span><br> <input type="text" name="e-effort" value="0" id="id_e-effort"> </div> <input id="form-submit" type="submit" value="save"> <input type="hidden" id="id_w-effort" name="w-effort" value="0"> </form> </div> I am definatly doing something wrong here. So, any hint would be very much apprechiated. regards, tom -- You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to jquery...@googlegroups.com. To unsubscribe from this group, send email to jquery-ui+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en.