Hi Bernardo,

Using your hidden method works.  I can see the "hidden" value from Form2 
but how do I use those hidden information in form2 so it can redisplay 
correctly?  First time around, it will use the variable from form1.  The 
second time around it should use the hidden information without the 
variable.  How do I achieve that?

You are correct!  I cannot carry the information to the second method in 
view having it the way it is so I've added the session under the 
cleaned_data of form1 and retrieved it at the beginning of form2.

data = name_formset.cleaned_data
request.session ['location'] = location
            request.session ['data'] = data

Step 1:  Form1 - Display First Name, Last Name, and location Input Field
Step 2:  Once user submit the information, render the data to form2 and add 
the checkbox next to it.
Step 3:  User choose to select the overwrite checkbox and then click 
"Confirm".
Step 4:  Form2 in view checked for 'POST' method and process cleaned data 
or return empty form2.  This stage created a "Management Form is Missing 
Error" because of the variables that I used in form1 to create the form2 
template are no longer there.  The {{ checkbox_formset.management_form }} 
is already in the template.

Here you can see that the names are displaying correctly.  By the way, I 
made an error in my original post.  It was supposed to be "last_name" not 
"last_address".


<https://lh3.googleusercontent.com/-wYXNdr1BOR0/VUfjn8SLaZI/AAAAAAAAJIc/5Pjw_LHsLz0/s1600/UHGCS.jpg>

form2.html
form2.html
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    {% load staticfiles %}
    <link rel="stylesheet" type="text/css" href="{% static 
'nodeform/style.css' %}" >
    <title>User Information</title>
</head>
<body>
    <h1>User Information:</h1>
    <form action="form2" method="POST">
    {{ checkbox_formset.management_form }}
    <div id="tablefont">
    <table id="table01">
        <tr>
            <th>First Name</th>
            <th>Last Name</th>
            <th class="center">Overwrite</th>
        </tr>
        {% for info in data %}
        <tr>
            <input id="id_nameform-{{ forloop.counter0 }}-first_name" 
name="nameform-{{ 
forloop.counter0 }}-first_name" type="hidden" value="{{ info.first_name }}" 
/>
        <input id="id_nameform-{{ forloop.counter0 }}-last_name" 
name="nameform-{{ 
forloop.counter0 }}-last_name" type="hidden" value="{{ info.last_name }}" />
            <td>{{ info.first_name }}</td>
            <td>{{ info.last_name }}</td>
            <td class="center"><input type="checkbox" name='overwrite' value
="1"></td>
        </tr>
        {% endfor %}
    </table>
    </div>
    <br>
    <p><input type="submit" value="Confirm">
    <a href="{% url 'form1' %}">
        <button type="button">Cancel</button></a></p>
    </form>
</body>
</html>




-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1ca19690-d44f-48e3-8755-d0530ac7fc03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to