As far as i remember according to the HTML specs the unchecked values
are not sent with form post.

So you can use some logic in your server side code to deduce the
unchecked values. (Since you render them in the first place so may be
you have a list of items from database)

or if you really want to sent them from HTML form use some javascript
to set those uncheck values in a hidden field.

Hope this helps.

On Nov 16, 11:56 pm, limas <[EMAIL PROTECTED]> wrote:
> hello all....
> I am doing a project in Django.
> I want to create a list by clicking upon a link, it will open up a new
> window using javascript window.open() method.
> I have two tables for list.
> class Saved_list(models.Model):
>         description=models.CharField(max_length=100)
>         number_entries=models.IntegerField()
>         date_created=models.DateTimeField(auto_now_add=True)
>         date_modified=models.DateTimeField(auto_now=True)
>
> class Saved_list_entry(models.Model):
>         saved_list=models.ForeignKey(Saved_list)
>         date_created=models.DateTimeField(auto_now_add=True)
>
> Onload all entries in the Saved_list is listed with description and
> number entries with a check box in front of it.
> I want to create new Saved_list. I have done it with a a link.
> When any one of the Checkbox is checked I want to increment the
> number_entries field and insert a new row in Saved_list_entry.
>
> my view is :
> def add_to_list(request):
>         saved_list=Saved_list.objects.all()
>         lists=saved_list.values()
>         if request.method=='POST':
>                 name=''
>                 for lst in lists:
>                         if request.POST[lst['description']]=='On':
>                                 name=lst['description']
>                                 break
>                 if name!='':
>                         try:
>                                 slist1=Saved_list.objects.get
> (description=name)
>                         except KeyError:
>                                 pass
>                         slist_entry=Saved_list_entry
> (saved_list_id=slist1.id)
>                         slist1.number_entries=slist1.number_entries+1;
>                         slist1.save()
>                 else:
>                         slist=Saved_list(description=request.POST
> ['listname'],number_entries=0)
>                         slist.save()
>         else:
>                 pass
>         return render_to_response('candidates/add_to_list.html',
> {'list':lists})
>
> and my template is:
>         <form action="" method="POST" name="list">
>         {% for l in list %}
>                 <input type="checkbox" name="{{ l.description }}">
>                 {{ l.description }} ({{ l.number_entries }})
>         {% endfor %}
>                 <td><input type="text" name="listname">
>                 <a href="javascript:document.list.submit()">Save</a>
>                 <input type="submit" class="button1" value="Add To List" 
> name="Add
> To List">
>                 <input type="button" class="button1" value="cancel" 
> name="cancel"
> onClick="window.close();">
>         </form>
>
> But i can't retrieve the unchecked checkboxes
> please help me......
> thanks in advance....
> Lima

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to