unclecheese / silverstripe-display-logic

The Display Logic module allows you to add conditions for displaying or hiding certain form fields based on client-side behavior.
BSD 3-Clause "New" or "Revised" License
74 stars 71 forks source link

Display Logic not work with LiteralField #15

Closed loba-b closed 9 years ago

loba-b commented 11 years ago

Like in topic. Display logic not hide/show etc... with LiteralField

LiteralField::create("ExampleLiteral", "Example text") ->displayIf("OtherField")->isEqualTo('SomeText') ->end(),

Sorry for my bad English

unclecheese commented 11 years ago

DisplayLogic, by design, won't work with LiteralFields because they don't return a predictable body of HTML to attach event handlers to. A literal field could even just return just a text node. There's no way to toggle the display of something that isn't contained in HTML.

A good work around solution might be this idea: https://github.com/unclecheese/silverstripe-display-logic/issues/12