Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

add link to $title checkbox field


Go to End


5 Posts   2154 Views

Avatar
bebabeba

Community Member, 193 Posts

3 November 2008 at 9:51pm

Hi!
I follow the guide to add checkbox.
new CheckboxField(
$name = "newsletter",
$title = "I would like to receive a monthly newsletter"
);

My problem is that i need a link for the text near checkbox, so a link for $title. Can you help me?

Avatar
Willr

Forum Moderator, 5523 Posts

4 November 2008 at 5:57pm

Sorry I don't quite understand what you are asking? Do you want some part of $title to be a link? You can embed the link in it just like HTML

new CheckboxField( 
$name = "newsletter", 
$title = "I would like to receive a <a href='link-to-page'>monthly newsletter</a>" 
);

Avatar
bebabeba

Community Member, 193 Posts

4 November 2008 at 10:16pm

My problem is that I want to add a file html in assets folder and use thickbox. I have a lot of error.

new CheckboxField(
$name = "privacy",
$title = "<a href="/assets/files/privacy.html?keepThis=true&TB_iframe=true&height=300&width=500" class="thickbox"> Accetta informativa (clicca sul link)</a>"
)

Avatar
Willr

Forum Moderator, 5523 Posts

4 November 2008 at 10:23pm

You cannot do $var = "string " " " - note the nested "' try

    $title = "<a href='assets/files/privacy.html?keepThis=true&TB_iframe=true&height=300&width=500' class='thickbox'> Accetta informativa (clicca sul link)</a>"

Avatar
bebabeba

Community Member, 193 Posts

4 November 2008 at 10:26pm

I try to include file in my function in this way:

require_once(Director::baseFolder() . '/files/privacy.html');
require_once(Director::baseFolder() . '/themes/underthebridge/css/thickbox.css');

but my error are link to
... ?keepThis=true&TB_iframe=true&height=300&width=500 class="thickbox"