who.html

<form method="post" class="treatment-form" id="{{ 
report_person.report_person.id}}" > {% csrf_token %}
  <table width="100%" id="list">
    <tr id="head-{{ report_person.report_person.id}}" class="ir-shade">
        <td style="width:150px;"><input type="button" name="delete"  value="{{ 
report_person.report_person.id}}" class="delete_icon" />
            {{report_person.report_person.name }}
        </td>
        <td> 
{{report_person.info.first_aid}}{{report_person.info.first_aid.label}}
        </td>
        <td>
            {{report_person.info.sick_bay}}{{report_person.info.sick_bay.label}}
        </td>
      </tr>
    {% if report_person.info.first_aid.value or 
report_person.info.sick_bay.value %}
    <tr id="div-{{report_person.report_person.id}}" class="ir-shade">
    {%else%}
    <tr id="div-{{report_person.report_person.id}}" 
class="ir-shade"style="display:none">
        {%endif%}
        <td class="ir-shade" colspan="4">
            <button id="{{report_person.report_person.id}}" type="button" 
class="add_treatment" class="button_style">Add treatment notes</button>
            <div id="result-{{report_person.report_person.id}}"  
class="toggle"></div>
        </td>
    </tr></table></form>

Inside this div <div id="result-{{report_person.report_person.id}}" 
class="toggle"></div> a save button which on click submit the 
"treatment-form" form.This div is basically hidden,if user press Add 
treatment notes button,the div gets open and details can be updated and by 
clicking save the form gets submited.

Since i am doing the save operation inside a ,if the user click first_aid 
alone and click next button it wont save.

I placed the same javascript onclick to submit the "treatment-form" form in 
next button.But my problem is if the <div> is in open condition the check 
box gets saved ,otherwise if user clickfirst_aid alone and without clicking Add 
treatment notes button, if they click next it is not saving.

see my both buttons:

<button id="save" type="submit" name="save" style="margin:0 5px;" 
onclick="$('.treatment-form').submit();" class="forward">Save <img 
src="/static/images/button-icon-ir-fwd.png" height="17" width="12"></button>  
//button inside the div

<a href="{% url incident.views.what %}"><button type="submit" title="Next"  
onclick="$('.treatment-form').submit();" name="save"  class="forward">Next <img 
src="{{ STATIC_URL }}images/button-icon-ir-fwd.png" width="12" height="17" 
alt="" /></button></a> //next button to perform save without opening the <div>


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to