views:

262

answers:

3

So earlier I asked a question about removing the label that Django forms have by default. That worked out great, and I removed the label. However, the text that is generated by the form is still there! I would very much like to remove the text. Here is what I mean:

<p>Text: <textarea rows="10" cols="40" name="text"></textarea></p>

I would like to remove the Text: part of this, as I do not want it. Again, it is generated with the form I create via:

{{ form.as_p }}

Here is the model I use for my form:

class CommentForm(forms.Form):
    comment = forms.CharField(widget=forms.Textarea())

EDIT: So far, I've looked at all of the documentation about the label tag and what stuff Forms generate. Apparently, this is possible to remove, it just does not tell me how. Also, I can remove the colon by adding:

label_suffix=None

I have now also tried label, label_tag, label_prefix, prefix, both in the form constructor and the charField constructor. Nothing.

As a parameter in the constructor, but this is not enough.

Anyone know how to fix this one?

EDIT2: I have changed around how the form is done:

class CommentForm(forms.Form):
    comment = forms.Textarea()

It's only that now. This means the Textarea is the problem. What parameter can I pass in the textarea or to the form that will remove the aforementioned problem?

A: 

Have you tried:

class CommentForm(forms.Form):
    comment = forms.CharField(widget=forms.Textarea(), label=None)

?

Grzegorz Oledzki
A: 

Try:

class CommentForm(forms.Form):
    comment = forms.CharField(widget=forms.Textarea(), help_text="")
lemonad
Tried, no luck.
AlbertoPL
+3  A: 

The answer:

class CommentForm(forms.Form):
    comment = forms.CharField(widget=forms.Textarea(), label='')

Also, no auto_id in the constructor when creating the object, it should be left as:

comment = new CommentForm()
AlbertoPL