Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-08-14 22:20:59

ricketyflange
New Member
Registered: 2006-08-14
Posts: 3

txp:comments_form tag & css class

I’m new to Textpattern so please don’t hurt me if I have made a fundamental error!

I want to assign a class to the html form tag generated by the txp:comments_form txp tag, as I understand it from the wiki entry I would add it as an attribute, getting this (where ‘myClass’ is the CSS class I want to apply):

<code> <txp:comments_form class=“myClass” /></code>

But it doesn’t appear to be working – it outputs the following html form tag:

<code> <form method=“post” action=”/blog/article/6/its-a-series-of-tubes#cpreview” id=“txpCommentInputForm”></code>

without a my ‘myClass’ class appearing in the tag – am I doing something wrong?

Any help greatly appreciated,
James

Offline

#2 2006-08-14 22:28:55

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: txp:comments_form tag & css class

The class would be applied to whatever wraptag you use. So do: <txp:comments_form wraptag="div" class="myClass" />

Offline

#3 2006-08-15 08:59:35

ricketyflange
New Member
Registered: 2006-08-14
Posts: 3

Re: txp:comments_form tag & css class

Thanks for your reply Mary – but that would style a containing div with ‘myClass’ – I want to apply the class to the html form tag so I can target the form directly, not the tag it is nested within – is this not possible?

Offline

#4 2006-08-15 18:36:12

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: txp:comments_form tag & css class

I want to apply the class to the html form tag… is this not possible?

No.

…so I can target the form directly, not the tag it is nested within…

Do: .myClass form {

Offline

#5 2006-08-17 17:51:36

ricketyflange
New Member
Registered: 2006-08-14
Posts: 3

Re: txp:comments_form tag & css class

Ok, thank you for your help.

Offline

#6 2006-08-25 02:57:40

mwillse
Member
From: brooklyn, ny
Registered: 2006-06-26
Posts: 83
Website

Re: txp:comments_form tag & css class

Txp does give the form an id.
id=“txpCommentInputForm”

So without the extra wrap tag, you can do:

#txpCommentInputForm {

Offline

#7 2006-08-25 03:33:09

mwillse
Member
From: brooklyn, ny
Registered: 2006-06-26
Posts: 83
Website

Re: txp:comments_form tag & css class

…although, I just noticed that the same ID is used for the thankyou after a comment is submitted. so you should use:

form#txpCommentInputForm { }

p#txpCommentInputForm { }

Offline

Board footer

Powered by FluxBB