data validation - only unique pairs are saved
Posted: Mon Jun 30, 2014 11:06 am
Hi
I want to perform data validation and only allow unique combinations of two values in a table to be saved. I can achieve this in mysql by both setting a primary key on these two columns (Col1,col2) and add a unique index (col 1, col2). But then Nubuilder just stalls when Save is clicked. I know that NuBuilder can't use the db constraints but has to use its own validation/joins.
I can perform the check by using NuOnSave in the Javascript tab, but I already use this function for something else? Can I combine several checks?
Or do I have to use the php function NuValidate Record on the Before Save tab?
How can I check if any combination already exists as a record in the db? (col1, col2) or (col2, col1)
Any help is appreciated, I have not written any code like this before. I hope it's easy
Tinka
I want to perform data validation and only allow unique combinations of two values in a table to be saved. I can achieve this in mysql by both setting a primary key on these two columns (Col1,col2) and add a unique index (col 1, col2). But then Nubuilder just stalls when Save is clicked. I know that NuBuilder can't use the db constraints but has to use its own validation/joins.
I can perform the check by using NuOnSave in the Javascript tab, but I already use this function for something else? Can I combine several checks?
Or do I have to use the php function NuValidate Record on the Before Save tab?
How can I check if any combination already exists as a record in the db? (col1, col2) or (col2, col1)
Any help is appreciated, I have not written any code like this before. I hope it's easy
Tinka