zanderwar
zanderwar

Reputation: 3730

Silverstripe HTML Block "Form Action"

Been searching around trying to find away to achieve a "HTMLBlock":

/**
 * @see \HTMLBlock
 */
$fields = array(
    TextField::create('myTextfield', 'My Text Field Label'),
    HTMLBlock::create('<div>Hey I put a HTML block between real fields'),
    TextField::create('myTextfield2', 'My Second Text Field Label')
)

Anyone able to provide a pointer on how to achieve this?

Upvotes: 1

Views: 208

Answers (1)

3dgoo
3dgoo

Reputation: 15794

We can use LiteralField to insert html into a form like so:

$fields = array(
    TextField::create('myTextfield', 'My Text Field Label'),
    LiteralField::create('myLiteralField1', '<b>some bold text</b> and <a href="http://silverstripe.com">a link</a>'),
    TextField::create('myTextfield2', 'My Second Text Field Label')
);

Upvotes: 3

Related Questions