-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with nested models and browser validations [v0.7.0-master] #2443
Comments
Hi, we are having the same problem and currently using the workaround mentioned by @tagliala . |
Related to: #2414 |
@tagliala When I write to
Then I opened edit page of my parent model. Pressed buttons to add nested child models, then pressed trash can then I have pressed Save button. After these actions Rails_Admin throws me error:
Which means that Rails_admin still wants to add model even if we removed. |
The bug is still present in v0.8.0 Thanks for referring me here @SuperMasterBlasterLaser ! |
@voyera You're welcome. In 0.6.* versions when required associations are empty and user presses Save buttton, Dashboard will highlight this field in red color and show message below from this field. However, it still showed that problem when user removes nested and tries to save. Now on current versions it just throws Javascript errors in console when you not assign value for required |
I think an effective way of solving this would be to add a class/id to the hidden/deleted nested entries that would bypass validations for those cases. Would that make sense? |
@voyera, @tagliala I have also found one strange bug. If you have models like this:
Each of them has When I open
This gives Validation error and says that I havent entered name for GrandChild. Then I open tab that has GranChild and there bug happens. It has TWO GRANDCHILDS Even if I created only one one of them, which has GreatGrandChild has empty name and other hase that name. Sorry for too big picture. But this happens when I try to create from scratch. If I remove extra appeared model and then try to save it it works. Older versions still have this . |
@tagliala, @Hamdiakoguz, @mshibuya, @voyera I think I have found why this is happening. When you click to When you click to remove this Child, it DOES NOT remove its child form from HTML it just changes its This makes validations of this form still active and admin page thinks that user still trying to add this child. Because data are empty that is why it is invalid and it tries to focus on this form to show to users that there are some invalid fields. There is one interesting thing happens on nested forms. If you click |
@SuperMasterBlasterLaser your fix doesn't cover the issue that the removed child models will still be created anyway right? |
@voyera I checked it on my test project. Works well. One thing that I have found out that when I click to remove child, it adds destroy command to hidden field and then makes it invisible. However, validation stil remains and does not allow us to save. You can check my pull request. My fix removes these validaitons on deleted childs |
Just merged #2490, please try the latest master. |
Thanks @mshibuya and @SuperMasterBlasterLaser ! |
Hi,
We found an issue with the latest released gem, still present in the master branch:
Models:
Rails Admin:
How to reproduce:
Nothing will happen. Check the browser console, you will find:
Workaround:
In
rails_admin.rb
Please let me know if you have a fast fix to this. I'm not familiar with that part of the source code
Thanks!
The text was updated successfully, but these errors were encountered: