Hi,

I have a form with two TextInput fields
link_name and tag_list. Form is submitted using dojoType button


<button type ="submit" onclick="document.forms.add.submit();"
dojoType="dijit.form.Button" size="12" >
  Save  </button>

Problem is after submit both TextInput fields remain empty and django
raises required field true exception.
Is there any problem with dojo submit button or something wrong in the
form below.
Please help, I have already spent lot of time figuring it out.

Thanks in Advance
Guri

*********************forms.py****************************************************

class tag_link_form(forms.Form):
    """ Form for saving a link with its tags
    """
def __init__(self,user,*args,**kwargs):
        super(tag_link_form,self).__init__(*args,**kwargs)
        self.user = user

        link_name = forms.URLField(error_messages={'invalid':'URL is
invalid'},widget =  forms.TextInput(attrs=attrs_text_dict), label=
(u'Url of Tut'),required=True)

      tag_list = forms.CharField(help_text="*only alphanumeric for
tags",widget = forms.TextInput(attrs=attrs_text_dict), label =
(u'Tags'),required=True)

def clean(self):
        """
        Verify tags are comma seperated
        """
        if 'link_name' in self.cleaned_data:
                if self.cleaned_data['link_name'] == '':
                        raise forms.ValidationError(_(u'Url cannot be
empty'))
        if 'tag_list' in self.cleaned_data and self.cleaned_data
['tag_list'] != '':
                for t in self.cleaned_data['tag_list'].split(' '):
                        if not alnum_re.search(t):
                                raise forms.ValidationError(_(u'Tag
can contain only alphanumeric characters'))
        else:
            raise forms.ValidationError(_(u'Atleast one Tag is
mandatory'))

        return self.cleaned_data

def save(self):
        """
        Creates link and Tag and saves in databases
        """
                     UserTagLink.objects.create_tag_link
(link_name=self.cleaned_data['link_name'],tag_list=self.cleaned_data
['tag_list'],user=self.user)

********************************************************************************

Thanks
Guri
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to