Verify data against database field

Skip to first unread message

Apr 7, 2021, 1:42:02 PM4/7/21
to Xataface
Ok, got a request from a (L)user of the system. 

There's a place where you can enter a 'relationship' between spouse, etc. The other person *SHOULD* have an account in the system already. What's desired is when someone enters their unique user name/number (like R184A8), and clicks SAVE, if that user name doesn't exist in the system, it should throw up an error message. 

Looks like the fieldname_validate is what I'm after, but don't see how to get that to look in the MySQL table, but just at what's on the screen.  Thoughts?

tom wible

Apr 7, 2021, 1:58:06 PM4/7/21
to Xataface
why not give them a list of users to pick from?
in fields.ini:
widget:type = select
vocabulary = selectUserByName

in valuelists.ini:
__sql__ = "SELECT Users.UserID, CONCAT(CAST(Users.UserID AS CHAR), ': ',Users.firstNAME, ' ', Users.lastNAME)  FROM Users  order by Users.lastNAME, Users.firstNAME;"

Apr 9, 2021, 7:13:14 PM4/9/21
to Xataface
Nice!  That is an excellent option. Thanks!
Reply all
Reply to author
0 new messages