Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-12-24 11:57:17

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

How to get a span tag in a form label?

I have a label tag like this:

<txp:mem_form_select_section name="article_section" label="Type <span>*</span>"  ........

With the resulting output:

<label for="classified_cat" class="memSelect  classified_cat">Category &lt;span&gt;*&lt;/span&gt;</label>

Anyone know if there is a way to get this to work? The goal is to use an asterisk for a required field and style it a little.

Offline

#2 2009-12-24 12:03:55

trenc
Plugin Author
From: ⛵️, currently Göteborg, SE
Registered: 2008-02-27
Posts: 574
Website GitHub

Re: How to get a span tag in a form label?

Uhm, you can make the askerisk as background-image for the label of the required fields.
So you can reduce some DOM-nodes and HTML-code.


Digital nomad, sailing the world on a sailboat: 32fthome.com

Offline

#3 2009-12-24 12:39:07

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: How to get a span tag in a form label?

Hey Tommy, yes I already tried that but had to adjust all the form widths – labels/textareas etc – in order to compensate for the padding required for the background image. Was looking for a simple way to output an asterisk and then style it red or something!

Offline

#4 2009-12-24 12:50:07

trenc
Plugin Author
From: ⛵️, currently Göteborg, SE
Registered: 2008-02-27
Posts: 574
Website GitHub

Re: How to get a span tag in a form label?

Ah yes, I understand.

A shoot in the dark: I don’t know but maybe it will work wrapped with single-quotes?

<txp:mem_form_select_section name="article_section" label='Type <span>*</span>'  ........

Digital nomad, sailing the world on a sailboat: 32fthome.com

Offline

#5 2009-12-24 12:59:50

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: How to get a span tag in a form label?

Afraid it doesn’t work! Nor does label="Type '<span>*</span>'" :(

Might have to go with the background image option..

Offline

Board footer

Powered by FluxBB