This topic is locked

JavaScript to Prevent Duplicate Items During InlineAdd

5/14/2022 9:17:57 AM
PHPRunner General questions
F
fahad225 authorDevClub member

Hello Everyone,

I am looking for a way I can prevent duplicate items durin inline Add before submiting records to the server. So this must be clientside preventing duplicate rows using Javascript.
I have searched this through the forum and manual help But did not find it. I beleive lot of people have the same issue.

BIG Thanks in advance to anyone who has the solution.

fhumanes 5/14/2022

Read the article https://fhumanes.com/blog/guias-desarrollo/guia-27-validaciones-por-ajax-personalizados/

Explain how you can make validations in the Server, from the client layer.

Regards,
fernando

F
fahad225 authorDevClub member 5/15/2022

Thanks Mr. fhumanes for your reply. I have checked your link and it is good, but it is talking about the server side validation, which means the code in your link is comparing the value from the form to a value stored in the database and that is not what I am looking for now.
For more clarification I want to compare and validate values from two or three inline add rows before they are submitted to the server.

admin 5/15/2022

The thing is that you can only check for duplicates on the server side, right in the database. So what Fernando suggests is that you initiate the AJAX request in Javascript, check for duplicates on the server side and get the results back in Javascript.

K
kohle 5/16/2022

Hi,
First,
I would define a unique index on the table. This protect your table from duplicate records.

rg
J.

F
fahad225 authorDevClub member 5/17/2022

Thank you all guys for your reply.

See the below link, This is what I am looking for
https://www.youtube.com/watch?v=Q7VaU5K9AXM