• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: HELP: make Primary key to prevent duplications

HELP: make Primary key to prevent duplications 14 years 8 months ago #8334

  • Jubranz
  • Jubranz's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
Hi,

please anyone help me in this:

I want to make a value as a primary key to prevent duplications.

lets say this input is for ID number as example, it should only accept a unique number each entry.

I believe it needs a script that verifies in the database if the information typed by the current user was submitted before or not.

please help me in this.
The administrator has disabled public write access.

Re:HELP: make Primary key to prevent duplications 14 years 6 months ago #8871

Sorry, I am afraid that will be rather hard to accomplish with the table structure used in RSForm Pro! Each submission is represented not by one row but by many so the traditional concept of a primary (or unique) key is not applicable, not even with multiple column keys. However, it may be possible to cause the database to fail by using an "on insert" trigger in Mysql. That is likely to give you an ugly looking error message but your database will remain consistent.

Another option would be to use the database mapping tool and store each submission in one row in a custom table and implement a unique key multicolumn constraint for that table. But I do not know how RSForm will handle constraint violations in mapped tables. It will definitely not manage to insert the data but it may go ahead and the send the mails anyway. That needs closer code scrutiny.

I think the better option is to implement some code in the "Script called on form process" to check each value in your form against the values already in the database. It will not be easy but I am sure it is possible. There are quite a number of examples in the manual on how to connect to the database and do custom scripting.

Yours
Claus
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!