C
C#9mo ago
dino2dy

❔ Access 2 properties from validationRule

Hi everyone, I have a valdiation rule on textbox ID when entering a new user. A user inputs ID which is a unique string every person has. I have a validation rule that checks the ID against the db column ID to see if it is unique and hasn't been inputted before. This all works. The issue is that you can also edit an existing user. The user that is edited will throw the validation error for ID because the validation rules still checks the ID against the DB. I wish to access the newRow property from the VM in the validationRule so that the rule would only throw an error if the newRow flag is true. How can I do this?
6 Replies
boiled goose
boiled goose9mo ago
(why would someone enter an id? it's managed by the db, if it's given by the user he could make mistakes)
dino2dy
dino2dy9mo ago
Its not an actual ID its a think like a social security nr for in my country just simpler to write ID
boiled goose
boiled goose9mo ago
ok, so you are saying the "validation rule" is in your code instead than in the table?
dino2dy
dino2dy9mo ago
Yes it is in my C# code why would it be in my table?
boiled goose
boiled goose9mo ago
for example given that that is a standard feature of every db you wouldn't have this problem
Accord
Accord9mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.