Closed manuel-bitcraft closed 1 year ago
Same here
Can one of you bisect that bug down to a particular commit?
Can one of you bisect that bug down to a particular commit?
It would be the introduction of sonata_type_collection inline edit i suppose since the problem is that an input with required attribute is inserted in the form and is not removed when the user changes his mind wich prevents submitting the form
I'll have a look but this looks more like a design problem than a bug
Maybe this issue should move to DoctrineORMAdminBundle ?
Maybe… I don't know.
As RomainSanchez said, I think this was always the case. I can open an issue on the DoctrineORMAdminBundle if you think is better. Thanks
without adding the name
If you want to delete a row, there's a button for that right? You don't expect an empty value to be accepted, do you ? Did you use allow_delete
or whatever the right option for this is?
If you want to delete a row, there's a button for that right?
It is a checkbox that needs the form to be submitted before the item is removed.So when you add an item and want to remove it (wich end users do all the time) checking the checkbox would need to remove the empty inputs from the dom
checking the checkbox would need to remove the empty inputs from the dom
Exactly. First thing to do on the js submit()
event
I'll see if i can find time in the next few days to make a PR for this
With html5 validation enabled you will still get a message before submit, not sure if we can solve this changing only the order of actions in submit() in javascript
IMO the problem is, add is done in ajax, remove is done on reload... not sure if this has an easy fix tho.
If it is a new entry you remove the inputs from the dom on click and if it is an existing one you remove from the dom and replace with a hidden input/hidden inputs that will "submit the deletion" or maybe trigger an ajax request to delete the item even before form submission
Well if you remove the input immediately when checking the checkbox (or cliking a button), problem solved. Also, you could just make toggle disable
on checking the checkbox
you could just make toggle disable on checking the checkbox
I'd say that is the way to go so things are consistent between deleting a freshly created entry and deleting an existing entry
After giving it a shot several questions arose:
1: disabling via javascript works fine but in wich template should the script be included? 2: Does the script need to handle the case where iCheck would be disabled ? 3: should the script itself live in AdminBundle or DoctrineORMBundle (I need to add classes to form elements in DoctrineORMBundle templates as well) 4: Should the changes be made on other storage bundles as well (mondoDB, PhpCr)?
no idea what iCheck is
ICheck is the js plugin used for checkboxes.
"sonata_admin" => array:9 [▼
"name" => "phones"
"admin" => ContactAdmin {#3294 ▶}
"value" => PersistentCollection {#4036 ▶}
"edit" => "inline"
"inline" => "table"
"field_description" => FieldDescription {#3775 ▶}
"block_name" => false
"options" => array:15 [▼
"use_icheck" => true
For 2, I'm unsure, I'd say it should work too…
If iCheck is enabled i need to listen to their ifChanged
event instead of change
but window.SONATA_CONFIG
has the info so problem solved.
inline editing is useful for the phpcr admin too, so if we can fix the infrastructure for that, please do it here in the base admin bundle
Hi, is there I documentation on how to use it? Didn't find it
I cannot find any activity on this matter after #4441 got merged so I guess this issue should be reopened.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Im suggest solving in any issue: Before set data we delete fisrt. @VincentLanglet you are closed not that issue. Problem solving here: https://github.com/sonata-project/SonataAdminBundle/issues/6391#issuecomment-709232369
I have followed @kirya-dev suggestions:
https://github.com/sonata-project/form-extensions/pull/414
Can someone confirm it works for their use case? cc / @VincentLanglet
I have a problem with sonata admin, specifically in a type collection field. Here's the scenario:
I have an entity called "Group" with a one to many relationship to the entity "Member"
In sonata admin I set up the admin classes for the 2 entities.
In the "Group admin" i create a collection type with the Member entity this way
The member entity has 4 fields, one of which is required.
If I click the "Add Member" button in the edit view, it adds a new row as expected. At that point, if I change my mind and decide to delete the newly added record, without adding the name, on save it's returning a validation error telling me 'Please enter the name.' on the field.
Shouldn't the delete action have priority over validation?