0

How can I create with jQuery a Fluid element, like:

<f:form.upload property="{something}" additionalAttributes="{form:someProperty(element: element, property: 'myProperty'}"></f:form.upload>

I tried to write something like:

var input = <f:form.upload property="{something}" additionalAttributes="{form:someProperty(element: element, property: 'myProperty'}"></f:form.upload>;
$(div).append(input);

But it will render litteraly the content of var input.


In other words.

What I get now wit my jQuery:

<f:form.upload property="{something}" additionalAttributes="{form:someProperty(element: element, property: 'myProperty'}"></f:form.upload>

What I want:

<input type="file" name="tx_form_formframework[application][fileupload]">
Danny_DD
  • 756
  • 1
  • 12
  • 34

2 Answers2

1

in short: you can't. This is because the <f:*> tags and {variables} are being processed on the server, not on the client.

Jquery could try to grab the processed HTML bits from the server via an HTTP request, but that's pretty much it :)

wmdb Mattes
  • 114
  • 2
  • mmm ok. But if I want to create more `input` forms in a dynamic way? I have no chance? My goal is to create a new `input`form when the one before is used, and then send everything in backend. – Danny_DD Jan 11 '18 at 11:52
  • You can simply create html input fields via jQuery or JavaScript. In addition you have to tell your extension that it's allowed to add new fields. By default and for security reasons it's not allowed to add some new fields via JS. See https://stackoverflow.com/questions/33996431/add-create-element-to-objectstorage-using-javascript-in-extbase-fluid-typo3 for an example how to dynamically add fields in extbase. – Alex Kellner Jan 11 '18 at 12:38
0

In some situations it is possible to create the form fields via Fluid in advance but hide them until the user takes a defined action.

Stefan Padberg
  • 505
  • 2
  • 17