This is the method in Normal HTML to accept only PDF
<input type="file" name="myFile" accept="application/pdf" />
But How to use it with Typo3 Fluid? When I gave like this
<f:form.upload name="myFile" accept="application/pdf" />
It showed me an error as below
#1237823695: Argument "accept" was not registered.
How can I do this in fluid?
(I'm using Typo3 7.6.21)
you can do this with additionalAttributes.
Here a link to the Fluid doc
https://fluidtypo3.org/viewhelpers/fluid/master/Form/UploadViewHelper.html
Complete ViewHelper Code looks like:
<f:form.upload additionalAttributes="{accept :'application/pdf'}" name="test2"/>
Related
Hi i want to use captcha in an html form in a Symfony 3.4 project , i installed and implemented the captcha bundle (Gregwar's CaptchaBundle)successfully but in the bundle's documentation in the part of adding the captcha to the form they are working with symfony form builder but i am working with normal HTML form using requests .
this is the code they provided in the bundle's documentation :
<?php
use Gregwar\CaptchaBundle\Type\CaptchaType;
// ...
$builder->add('captcha', CaptchaType::class); // That's all !
// If you're using php<5.5, you can use instead:
$builder->add('captcha', 'Gregwar\CaptchaBundle\Type\CaptchaType');
// ...
this is my html form where i want to add the captcha
<form class="row" method="post" action="{{path('envoyerchat')}}">
<input type="text" name="test2">
<input type="text" name="test1">
<!-- add captcha here -->
<!-- add captcha here -->
<input type="submit">
</form>
can i convert that code which works with fom builder to my html form ?
I'm having trouble with a global variable, I think it might be pulling its data from a HTML Form Input, but I can't find any documentation on the web about global var pulling data from a HTML Form Input.
Thanks.
When a form is submitted the method tag specifies if it is a POST or GET request. Depending on what method your form is using your form values can either be in your $_POST or $_GET Super global.
Example:
<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
After the submit button on the form is clicked the form contents can be found by referencing the name attribute in the super global(In this case the POST).
$_POST['name']
$_POST['email']
For documentation see
http://php.net/manual/en/reserved.variables.post.php
This applies to PHP 4 >= 4.1.0, PHP 5, PHP 7 ie. fits PHP 5.3.
I'm building a typo3 extension and in a backend plugin I want to build a image upload form. I seem not to get the correct $_Files url. The following fluid form is used:
<f:form action="customerSliderImages" id="customerSliderImages">
<f:form.upload name="custSlider[sliderimage]" />
<f:form.submit value="Upload" />
</f:form>
I want to have the [name] and [tmp_name] to store the image, but I don't get the correct url. Also I don't know to echo $_Files for debugging. I tried the following but not working:
$_FILES["tx_mtclnt_user_mtclntmtcus"]["tmp_name"]["custSlider"]['sliderimage']
$_FILES["tx_mtclnt_user_mtclntmtcus"]["name"]["custSlider"]['sliderimage']
It seems you did not define the enctype attribute on the <f:form> tag.
<f:form ... enctype="multipart/form-data"> ... </f:form>
See also:
http://www.w3schools.com/tags/att_form_enctype.asp
http://wiki.typo3.org/Fluid#f:form
I am playing around a bit with Perl and auto-filling out forms. However, when I view the source code and paste the "action" URL of a form into my browser, it goes to a "Page Not Found". How could this be? If data is able to be submitted to a page then wouldn't the page have to exist? Or am i just missing something?
For instance, the HTML looks like:
<form action="/Pages/somepage">
<input type="text" name="email" />
<input type="submit" />
</form>
So if i go to http://thewebserver.com/formPage/Pages/somepage it simply displays a "Page Not Found" error.
Thanks.
If the form action is "/Pages/somepage", then the correct full URL will be http://thewebserver.com/Pages/somepage, not http://thewebserver.com/formPage/Pages/somepage. Not sure where you got that "formPage" from.
I have setup a site to use flux / FLUIDCONTENT for templates and have it working using the tutorial here: http://thomas.deuling.org/2011/06/create-base-html-fluid-templates-for-typo3-4-5/
It's all working well but now I want to be able to choose an image per page and use it to build a big header. With templavoila I could create fields that were available in the page properties but can't seem to get it working with FLUIDCONTENT.
I am using Typo3 6.1 and here is my inside page flex template:
{namespace v=Tx_Vhs_ViewHelpers}
{namespace flux=Tx_Flux_ViewHelpers}
<f:layout name="main" />
<f:section name="content">
<f:format.raw>{content_header}</f:format.raw>
<div id="content">
<div class="container">
<div class="row">
<div class="col-md-3">
<f:format.raw>{content_left}</f:format.raw>
</div>
<div class="col-md-9">
<f:format.raw>{content}</f:format.raw>
</div>
</div>
</div>
</div>
</f:section>
How can I add form fields to page properties and use them in my templates?
I am afraid, you mix things up a bit.
flux, fluidcontent and (especially important for you) fluidpages play together to extend the default capabilities of creating fluid templates for TYPO3.
flux Is the base technology for parsing and reconstituting TYPO3 form fields.
fluidcontent utilizes flux to allow Flexible Content Elements
fluidpages utilizes flux to allow Page Layouts in pure fluid with custom fields
To summarize: You have read a tutorial concerning basic fluid page templating, but not fluidpages templating. To get you started quickly, there are some examples and documentation resources available:
The quickstart from the documentation repository
The speciality provider extension from the bootstrap package (please use with caution-this is an example, not your next project template)
the extensions fluidcontent_bootstrap and fluidpages_bootstrap
When you are through those resources, you know how to register a provider extension, so that you can select it in the page properties in the backend.
Your template might look something like this (it's actually taken from the aforementioned speciality extension):
<!-- Note that the namespace declaration depends on which version of flux you are actually using -->
{namespace v=Tx_Vhs_ViewHelpers}
{namespace flux=FluidTYPO3\Flux\ViewHelpers}
<f:layout name="Page"/>
<div xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:v="http://fedext.net/ns/vhs/ViewHelpers"
xmlns:flux="http://fedext.net/ns/flux/ViewHelpers"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<f:section name="Configuration">
<flux:form id="1column" label="1 column layout">
<!-- Options visible in page property -->
<flux:field.input name="settings.carousel.categories" eval="trim" default="4" />
<flux:field.input name="settings.carousel.width" eval="trim" default="1200"/>
<flux:field.input name="settings.carousel.height" eval="trim" default="340"/>
<flux:field.checkbox name="settings.carousel.caption" default="1"/>
<!-- Grid displayed in the page module -->
<flux:grid>
<flux:grid.row>
<flux:grid.column colPos="0" label="Main Content"/>
</flux:grid.row>
</flux:grid>
</flux:form>
</f:section>
<f:section name="Content">
<div class="row" role="main">
<div class="col-md-12" role="section">
<v:page.content.render column="0"/>
<f:if condition="{v:var.typoscript(path: 'lib.addthis.display')}">
<f:render section="AddThis" partial="AddThis" optional="TRUE" arguments="{_all}"/>
</f:if>
</div>
</div>
</f:section>
</div>
Most flux templates (regardless wether fluidpages or fluidcontent) are split up into (at least) 3 f:section fluid sections:
Configuration takes your form fields
Preview influences how your template is being previewed in the backend
Usually Content or Main (you can influence the naming, in your Layout files but should stick to the conventions we spread accross the example extensions) renders your FCE/Page template
The field items are usable by accessing them via their name attribute as getter. To illustrate this, you could access {settings.carousel.caption} from inside the page template above.