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.

Form Questions

LiteralField in template


5 Posts   1992 Views


4 February 2010 at 10:18am Community Member, 22 Posts

sorry my noob question but I do not understand why not see in template LiteralField.

- create class MyForm
- create template in "include" folder
- use $dataFieldByName(nameLiteralField) or $nameLiteralField but nothing include in my template

DropdownField, TextField and etc normal include in template


5 February 2010 at 2:04pm Community Member, 22 Posts

i think i'm use not right method anyone can help me?

i'm find in \sapphire\forms\FieldSet.php function collateDataFields() if set $isIncluded = true;($field->hasData() return false is my problem) LiteralField work, but not good variants


7 May 2010 at 4:55am Community Member, 2 Posts

I ran into the same problem. Every other field i needed works perfectly with $dataFieldByName(Name), but not LiteralField. Any one has a good solution?


18 January 2011 at 7:23pm (Last edited: 18 January 2011 7:25pm), Community Member, 14 Posts

Unless I'm missing something this seems to have been overlooked in the Form class. While there is a method to access all Data fields:


This function returns all fields with data and will not return literals, headings etc.
With a little creativity it is possible to circumvent the functions in the Form class and access the FieldHolder method from the FieldSet directly for these fields in your custom form template via:

<!-- In -->

Hope that helps!


28 February 2011 at 5:07am Community Member, 129 Posts

Thanks Weareorganism

This worked for me...