neos / fusion-form Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
In Neos.Fusion.Form:FieldContainer the class property is ignored and the error class is always rendered.
In my opinion the condition for the error class should be in braces. That worked for me.
PR: #54
When data
properties are used inside header or footer part of the form, the Neos.Fusion.Form:Runtime.RuntimeForm
strips it's values when form is validated / processed.
The data
should be keept intact if for instance the form has a custom footer button and code which should persist a form validation / reload.
Neos.Fusion.Form:Runtime.RuntimeForm
data
properties like custom submit buttondata
properties are lost- Flow: 8.3
- Neos: 8.3
- PHP: 8.1
All data
properties passed inside the form content withstand the issue and are working properly.
If you have a label
with the attribute for
it needs an form field who has also id
. The name
attribute is not enough
The handling of Flow Entities as identifier strings has to be checked. Probably this will not work yet.
At the current point we assume that no additional and hidden identity fields are needed.
When using a form like this for calling a delete action (deleteAction(Company $company)
), the required argument is missing, even though props.company
contains the correct entity:
<Neos.Fusion.Form:Form form.data.company={props.company} form.target.action={"delete"}>
<button type="submit" class="neos-button neos-button-danger" title="Eintrag löschen">
Ja, diesen Eintrag löschen
</button>
</Neos.Fusion.Form:Form>
When "using" something from the entity like below, it works:
<Neos.Fusion.Form:Form form.data.company={props.company} form.target.action={"delete"}>
<!-- Necessary to enable the delete method, without this hidden field the identity were -->
<Neos.Fusion.Form:Neos.BackendModule.FieldContainer field.name="company[description]" label="">
<Neos.Fusion.Form:Hidden/>
</Neos.Fusion.Form:Neos.BackendModule.FieldContainer>
<button type="submit" class="neos-button neos-button-danger" title="Eintrag löschen">
Ja, diesen Eintrag löschen
</button>
</Neos.Fusion.Form:Form>
Feels wrong to me…
Some FieldTypes like Checkbox, Password, Hidden are not yet implemented.
Maybe we also want a generic Neos.Fusion.Form:Input fieldType that allows to define the type via prop.
There should be a pure fusion way to define forms and connect them with the data handling code.
For some form fields like checkboxes an empty value is needed to ensure that null values get actually submitted. Those empty values should be created in the form rendering by parsing the content similar to what is done for trusted properties.
While not necessary making the target of a runtime form configurable would allow:
Currently the token uses a very simple xpath selector to find all names. We will probably have to tweak this and check wether the empty "[]" at the end of multivalues are already properly supported.
Those are annoying especially when using GET as method.
Szenario:
Have two different forms on one page. Bind the forms to an object so that the fields are filled form properties of that object.
If you now submit one of the forms and you have validation errors the values in the not submitted form are cleared.
The Method field.findCurrentValueByPath()
returns NULL for every form field of the unsubmitted form.
Thats because $this->form->getResult()->hasErrors()
is true for both forms and not just for the form that got submitted.
Expected Behaviour:
All form fields of the form that has not been touched should still display the properties of the bound object.
Recently we had several request for manipulating form state initialization like:
The implementation suggests to use the parent request like this:
<Neos.Fusion:Form
form.object={example}
form.name="example"
form.request={request.parentRequest}
method="post"
>
we have to check wether this really suits the use cases for the feature
The MultiValues for Checkboxes and Selects have to be implemented. Currently this is only done for a MultiSelectBox.
It is possible that a MultiFieldDefinition is needed which would allow us to add strict types to the form definition getValue again.
Hey guys,
in Class: Neos.Fusion.Form/Classes/Eel/FormHelper.php the FieldDefinition constructor gets called with $multiple as NULL, but the corresponding getter only returns boolean.
FormHelper Line ~84:
if (!$name) {
/** new FieldDefinition(string $name = null, $value = null, $multiple = false, ...) **/
return new FieldDefinition(null, null, null);
}
*FieldDefinition Line: ~71:
/**
* @return bool
*/
public function isMultiple(): bool
{
return $this->multiple;
}
With the following form configuration in place the submitted data
values contain only the first selected file of the multiple file upload field attachments.
I have discovered that the underlying issue is how the __trustedProperties
field value is created.
Form configuration
prototype(My.Package:Content.ApplicationForm) < prototype(Neos.Neos:ContentComponent) {
renderer = Neos.Fusion.Form:Runtime.RuntimeForm {
namespace = 'application_form'
process {
content = My.Package:Components.ApplicationForm
schema = Neos.Fusion.Form:Runtime.SchemaCollection {
name = ${Form.Schema.string().isRequired()}
email = ${Form.Schema.string().isRequired().validator('EmailAddress')}
attachments = ${Form.Schema.arrayOf(Form.Schema.resource().isRequired().validator('Neos\Fusion\Form\Runtime\Validation\Validator\FileTypeValidator', { allowedMediaTypes: ['image/jpeg', 'application/pdf'] }))}
picture = ${Form.Schema.resource().isRequired().validator('Neos\Fusion\Form\Runtime\Validation\Validator\FileTypeValidator', { allowedMediaTypes: ['image/jpeg'] })}
}
}
action {
email {
type = 'Neos.Fusion.Form.Runtime:Email'
options {
senderAddress = ...
senderName = ${data.name}
replyToAddress = ${data.email}
recipientAddress = ...
subject = "..."
attachments {
multipleFileUpload = ${data.attachments}
singleFileUpload = ${data.picture}
}
text = "..."
}
}
}
}
}
prototype(My.Package:Components.ApplicationForm) < prototype(Neos.Fusion:Component) {
renderer = afx`
<fieldset>
<legend>Application form</legend>
</fieldset>
<Neos.Fusion.Form:FieldContainer field.name="name" label="Name">
<Neos.Fusion.Form:Input>
</Neos.Fusion.Form:FieldContainer>
<Neos.Fusion.Form:FieldContainer field.name="email" label="Email">
<Neos.Fusion.Form:Input
attributes.type="email"
/>
</Neos.Fusion.Form:FieldContainer>
<!-- multiple file upload-->
<Neos.Fusion.Form:FieldContainer field.name="attachments" label="Attachments">
<input
name={field.getName() + '[]'}
type="file"
multiple={true}
/>
</Neos.Fusion.Form:FieldContainer>
<!-- single file upload-->
<Neos.Fusion.Form:FieldContainer field.name="picture" label="Attachments">
<Neos.Fusion.Form:Upload />
</Neos.Fusion.Form:FieldContainer>
`
}
Currently the fields that are added to the FormRequest are only validated on the uppermost layer against the trustedProperties.
This should be made a recursive algorithm eventually.
When using Select with Options the rendering can break in some cases when passing domain models (or other objects) to the option value. This is because of the following code in prototype(Neos.Fusion.Form:Select.Option)
:
renderer = afx`
<option
value={option.getTargetValueStringified()}
selected={props.selected}
{...props.attributes}
>
{props.content || option.getTargetValue()}
</option>
`
this should be changed to:
...
{props.content || option.getTargetValueStringified()}
...
FieldContainer:
FieldComponent:
Questions:
// HINT: the "value" argument (4) is null here, because "field.value" should only be filled with the CHOSEN value;
// in these two cases:
// - when an object is bound to the form, and "property" is defined
// - when the form is re-shown in case of a validation error.
// We use field.value to determine if we should check the value.
@context.field = ${Form.createFieldDefinition(this.form, this.name, this.property, null)}
The getName()
method of the Field
domain model always returns the field name with its namespace.
Would you be open to add a getter "get name without namespace" (how should we name it)?
My use case:
To add frontend validation for my form, I need to evaluate the Schema definition of a field. So I want to check if field foo
is configured in the SchemaDefinition
. Since the schema definition uses the field name without namespace, I cannot look it up without such a getter.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.