1505 Posts in 474 Topics by 460 members
Form Questions
SilverStripe Forums » Form Questions » LiteralField in template
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba
|
Page:
1
|
Go to End | |
| Author | Topic: | 1308 Views |
-
LiteralField in template

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 templateDropdownField, TextField and etc normal include in template
-
Re: LiteralField in template

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
-
Re: LiteralField in template

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?
-
Re: LiteralField in template

18 January 2011 at 7:23pm Last edited: 18 January 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:
<?php
//...
getDataByFieldName(FieldName);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 customformtemplate.ss -->
$Fields.FieldByName(YourLiteralFieldName)Hope that helps!
| 1308 Views | ||
|
Page:
1
|
Go to Top |



