Unique validation not working on subentity form edit

Post Reply
eddydeniro
Posts: 174
Joined: 23 Feb 2021, 16:31
Name: Edi Supriyadi
Location: BDG Indonesia

Unique validation not working on subentity form edit

Post by eddydeniro »

Steps to reproduce
(lets use the pre-made entity Projects and Tasks):
1. In Entities List, make the Tasks' Name unique.
2. Create nested entity form on entity Projects for the Tasks. Set the fields display "In a new window".
3. Go to the form, add at least one project record and one task record. Save.
4. Open again the same project and edit the task. Now I cannot save the edit result, the unique validation keeps telling me that the task name is not unique, which is strange because that's the one and only task.
UniqueValidationOnNestedForm.png

Possible fix
In file modules/subentity/views/form.php, I added this on line 56:

Code: Select all

$current_item_id = $subentity_form_params[2];
User avatar
support
Site Admin
Posts: 6215
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: Unique validation not working on subentity form edit

Post by support »

Can't reproduce this issue. Do you use 3.1 version?
Can you reproduce this issue on personal demo?
https://www.rukovoditel.net/account_dem ... quest=demo
eddydeniro
Posts: 174
Joined: 23 Feb 2021, 16:31
Name: Edi Supriyadi
Location: BDG Indonesia

Re: Unique validation not working on subentity form edit

Post by eddydeniro »

I use v3.0.1
The same result on demo.
UniqueValidationOnNestedFormOnDemo.png
User avatar
support
Site Admin
Posts: 6215
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: Unique validation not working on subentity form edit

Post by support »

I think I have found issue. Files from archive replace to folder where app is installed. Let me know if it works ok now.
Attachments
form_fix1.zip
(6.67 KiB) Downloaded 97 times
eddydeniro
Posts: 174
Joined: 23 Feb 2021, 16:31
Name: Edi Supriyadi
Location: BDG Indonesia

Re: Unique validation not working on subentity form edit

Post by eddydeniro »

Yes, it works as expected now.
Thank you, Sergey.
Post Reply