I have a custom "Contact Us" form that sits within my Sitepackage - using TYPO3 v10.
The form works fine and I'm able to insert the form on any page the same way you'd insert any other form/content element.
What I'd like to do is have the form present on every page by adding it to my global layout template, so that it sits in the footer.
From the docs, I added this to my Fluid layout template:
<formvh:render persistenceIdentifier="EXT:my_site_package/Resources/Private/Forms/my_contact_us.form.yaml"/>
And I added this to my form conf (my_contact_us.form.yaml):
renderingOptions:
controllerAction: perform
addQueryString: false
argumentsToBeExcludedFromQueryString: [ ]
additionalParams: [ ]
When I do this, I get a type error:
Argument 1 passed to TYPO3\CMS\Extbase\Service\ExtensionService::getPluginNameByAction() must be of the type string, null given
Is there something I haven't configured correctly? Any help is appreciated, thanks again.
I also experienced that some time ago and just a couple of hours ago..
Fixed it - for now within a workaround - by overwriting the lines between 235-241 where the \TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper sets as default null values for action, controller, extensionName and pluginName.
Replacing that with this:
$formActionUri = $uriBuilder->uriFor(
$this->arguments['action'] ?? 'render',
$this->arguments['arguments'] ?? [],
$this->arguments['controller'] ?? 'FormFrontendController',
$this->arguments['extensionName'] ?? 'form',
$this->arguments['pluginName'] ?? 'Formframework'
);
Works fine for myself right now. Tested on TYPO3 v10.4.13
Related
I tried to implement a form with form framework in the news detail view. The basic way is explained here:
https://docs.typo3.org/c/typo3/cms-form/10.4/en-us/I/Concepts/FrontendRendering/Index.html#render-within-your-own-extbase-extension
Viewhelper:
<formvh:render persistenceIdentifier="EXT:myext/Resources/Private/Forms/myforms.form.yaml"/>
Form definition:
renderingOptions:
controllerAction: detailAction
addQueryString: true
submitButtonLabel: Absenden
fluidAdditionalAttributes:
class: ''
identifier: myForm
label: 'myLabel'
type: Form
prototypeName: myPrototype
The form is displayed. When I submit the form the news detail view is shown again including the form, but it's empty. The form is not processed. Something is missing, but I cannot find it in the manual.
Thanks!
I think the important part is written in the note below the linked paragraph:
In general, you can override each and every form definition with the help of TypoScript (see ‘TypoScript overrides’). This feature is not supported when you are rendering forms via the RenderViewHelper.
Luckily, there is a solution for your problem: use the ‘overrideConfiguration’ parameter instead. This way, you can override the form definition within your template. Provide an according array as shown in the example below.
<formvh:render persistenceIdentifier="EXT:my_site_package/Resources/Private/Forms/MyForm.yaml" overrideConfiguration="{renderables: {0: {renderables: {0: {label: 'My shiny new label'}}}}}"/>
That means you can check for post-variables by TypoScript conditions and adjust the controllerAction (and view) accordingly. The show / detail action is not processing the form usually, so it's logical that another action has to be assigned. I'm not sure in the moment if it does matter if double opt-in or a confirmation page shall be shown, that might depend on the form-extension.
After some hours of experimenting i was able to solve the problem. It ist simply a matter of caching ...
Georg has implemented in news a special caching engine which ignores the config.no_cache = 1 definition in setup. So the detail view of news is always cached even when the whole installation ist set to config.no_cache = 1. So this combination seems to work:
Viewhelper in Detail.html:
<formvh:render persistenceIdentifier="EXT:myext/Resources/Private/Forms/myforms.form.yaml"/>
And this definitions in the yaml file of the form:
renderingOptions:
controllerAction: detail
addQueryString: true
submitButtonLabel: Absenden
additionalParams:
no_cache: 1
identifier: myForm
label: 'myLabel'
type: Form
prototypeName: myPrototype
This renders the whole page without cache which is not optimal. It would be better when only the news entry is rendered without cache. and there is the problem, that in many installations the parameter 'disableNoCacheParameter' is set in the localconfiguration file which disallowes no_cache=1 in urls.
So i looked for an other - better - possibility to work around this problem.
First make a new fluid template anywhere in your resources folder with the modified viewhelper from above:
<formvh:render persistenceIdentifier="{settings.persistenceIdentifier}"/>
Then write a typoscript like this:
lib.embeddedForm = COA_INT
lib.embeddedForm {
10 = FLUIDTEMPLATE
10 {
file = EXT:myext/Resources/Private/Forms/myForm.html
settings {
EXT:myext/Resources/Private/Forms/myforms.form.yaml
}
extbase {
pluginName = Formframework
controllerExtensionName = Form
controllerName = FormFrontend
controllerActionName = perform
}
}
}
And final you can embed the form with
<f:cObject typoscriptObjectPath="lib.embeddedForm" />
as COA_INT in the news template. This disables the caching of the form.
Perhaps it helps ...
I need help with powermail.
I'm using Typo3 6.2.4 and powermail 2.0.16.
Something is wrong cause nothing appear in the frontend, but I don't what and I need some helps.
I created a new root page with the basic template "HELLO WORLD!" (ID = 15).
# Default PAGE object:
page = PAGE
page.10 = TEXT
page.10.value = HELLO WORLD!
In this template, I included two statics templates : "Main Template (powermail)" and "Add basic CSS (powermail)"
After that, in the root page, I created the folder "Powermail" to stock the data. (ID = 241)
And I created a second folder ("Form"; ID = 242).
In the folder "Form", I created a new Form ("registration") with the setting : Layout=Layout1; Language=Default; And the checkbox "Hide" is not checked
In this one, one Pages ("registration data") with the setting : Layout=Layout2; Language=Default; And the checkbox "Hide" is not checked
In "registration data", two fields, one for the name (Name of the sender) and one for the mail (Email of the sender) with setting : Mandatory Field=Checked; Layout=Layout3; Language=Default; And the checkbox "Hide" is not checked
And after that, in the root page, I created a new content element "powermail".
In the tab General, I set the header = Registration
In the tab Plugin, I selected Powermail. After, this is the setting : Selected Items=registration; Confirm page=checked;
Receivers Name=My Name; Receivers Email=MyName#gmail.com; Subject=My test;
Sender Name=A Name; Sender Email=AName#gmail.com; Subject=test;
In the tab Behaviour, Recursive=0 levels;
It seems that you are missing the proper typoscript to actually show the form on the page.
The specified typoscript snippet is not enough to show the content elements on the page.
Inside your typoscript template include the css_styled_content static template and change the snippet to this:
# Default PAGE object:
page = PAGE
page.10 < styles.content.get
That should ensure proper showing on the frontend. This is basic as it is, if you want it to be better looking, or different templating you should take a look at templating with TYPO3 first.
Using automaketemplate (not templavoila), the following works fine in typo3 4.5.2 and displays "This is the the current page title... Whatever the page title is" :
First place the following ts in an extension template:
page.10.subparts.pageTitle = TEXT
page.10.subparts.pageTitle.field = title
page.10.subparts.pageTitle.field.debugData = 1
Next, enter the following in a header content element in the BE:
This is the current page title... {page:title}
However, when updating to version 4.5.24 , the page title no longer replaces {page:title} and just displays "This is the current page title: {page:title} "
Perhaps there is a better way to do the above? Something that will work in 4.5.24 + ? I have followed all the upgrade procedures but to no avail.
Beware, don't use debug stuff in Production.
The field names in curly brackets are for use in Typoscript, not in the BE, together with insertData.
As such, for example:
page.10.subparts.pageTitle = TEXT
page.10.subparts.pageTitle.value = <h1>{page:title}</h1>
page.10.subparts.pageTitle.insertData = 1
If you want to combine, say a content element's title with the page title, do this in the TS template.
For use with css_styled_content (Have a look at /typo3/sysext/css_styled_content/static/setup.txt, you can override everything from here), I would try overriding this:
lib.stdheader.10.2.dataWrap = <h2{register:headerStyle}{register:headerClass}>|</h2>
by this:
lib.stdheader.10.2.dataWrap = <h2{register:headerStyle}{register:headerClass}> - {page:title}|</h2>
as we're already using dataWrap, it should be sufficient!
I can't disable escaping in a Zend_Form_Element_Submit, so when the label has special characters it won't display it's value..
This is my actual Zend Form piece of code:
$this->submit = new Zend_Form_Element_Submit('submit');
$this->submit->setLabel('Iniciar Sesión');
$this->submit->setIgnore(true);
$this->addElement($this->submit);
I've tried $this->submit->getDecorator('Label')->setOption('escape', false); but I obtain an "non-object" error (maybe submit isn't using the "Label" Decorator)..
I've also tried as suggested $this->submit->setAttrib('escape', false); but no text will be shown either.. Any idea? Thanks
Should be as simple as doing this:
$element->addDecorator('Label', аrray('escape'=>false));
Or see setEscape(). http://framework.zend.com/manual/1.12/en/zend.form.standardDecorators.html
Regarding failure to retrieve named decorator... Try getDecorators() Do you see 'label' in the results?
There is no Label decorator for submit form element by default (this is why you get the error).
The $this->submit->setLabel('Iniciar Sesión'); value goes to Zend_View_Helper_FormSubmit, which always does escaping and uses the label as a value.
The helper used by the Submit element escapes by default. Unlike with the label decorator, submit labels are included in a HTML attribute so they need to be escaped.
Your label - Iniciar Sesión - is a perfectly valid UTF-8 string, so the escaped version of it will be the same. If your label is not appearing then something else is going wrong. I'd guess that your page is being served using a charset that doesn't match what Zend View is using (UTF-8 by default).
View the page source to see what actually gets output - that might give you some more clues. Alternatively if the page this form is on is public, if you can provide a URL we might be able to spot the issue.
I ran into a similar issue. In my instance, I added both a label and a description to a text field element. This line of code allowed me to turn off the html escaping for the description attached to that field element:
$form->getElement('txtUPC')->getDecorator('description')->setOption('escape', false);
In my testing, the setEscape() was not recognized by the form elements or their decorators.
I have a telerik Grid, AJAX binded.
I've added an EditorTemplate to create a DropDownList.
When I push edit / insert in the grid - I can see the DropDownList, but when I try to use it - it doesn't work.
so I've added an int test to the viewmodel, decorated it with the same UIHINT,
and added it to the view.
The DropDownList works great.
What can cause Telerik's grid to disable that activity ?
I've the same problem with the DateTime component, I get the "button" to show the component, but pressing it yields nothing.
UPDATE: changing the DropDownList from :
Html.Telerik().DropDownList()
.Name("ActivityID")
.BindTo(new SelectList((IEnumerable)ViewData["DropActivities"], "Id", "Name"))
to:
Html.DropDownList(null /* the "name" should be null - proper "name"" attribute will be set by the runtime */,
new SelectList((IEnumerable)ViewData["DropActivities"] /*a list of all employee names */,
"Id", "Name"))
Made it work inside the grid, but... when I try to update, I Get 500 server error.. it looks like the selection doesn't pass well back to the model.
Well, it looks like a confirmed bug with telerik.
Here is the post from their forum: Script Registrar Not Loading Scripts for Controls used in Client Templates
I did applied the patch and it didn't solved the problem waiting for the next version.
EDIT: make sure the bound variable apears only once - that might cause the "lockdown".