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 /

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

LiteralField in template

Go to End

5 Posts   2882 Views


Community Member, 22 Posts

4 February 2010 at 10:18am

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


Community Member, 22 Posts

5 February 2010 at 2:04pm

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


Community Member, 2 Posts

7 May 2010 at 4:55am

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?


Community Member, 14 Posts

18 January 2011 at 7:23pm

Edited: 18/01/2011 7:25pm

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!


Community Member, 134 Posts

28 February 2011 at 5:07am

Thanks Weareorganism

This worked for me...