AnsweredAssumed Answered

How to create a registration form and check for existing usernames

Question asked by ArmutElma on Mar 21, 2014
Latest reply on Mar 24, 2014 by ArmutElma

Title

How to create a registration form and check for existing usernames

Post

     Hello,

     I'm trying to create a "simple" register script. I've created 4 fields:

         
  1.           username
  2.      
  3.           UnameCheck
  4.      
  5.           password
  6.      
  7.           SetPassword

      

     So user enters a preferred username into the UnameCheck field.

     Script aims to search the username field against what the user just entered into UnameCheck field to see if that username is already in use.

     If found, show custom dialog box to prompt user to enter a different username.

     Else set username to UnameCheck

     Here's what I've done so far. It's not doing what I intend to do. I know the issue is with comparing two fields and I'm pretty sure I'm not doing it right. So please help:

Register Script:

New Record/Request

Show Custom Dialog ["Register"; "Please provide a username and password" TableName:UnameCheck; TableName;SetPassword"

Perform Script ["UsernameCheck"]

UsernameCheck Script:

Set Error Capture [On]

Find Matching Records [Constrain; TableName:username]

If [Get (LastError) = 401]

     Set Field [TableName::username; TableName:UnameCheck]

Else

   Show Customer Dialog ["Username in use"; "If you have already registered, please use the login link. Otherwise please pick a different username"]

   Exit Script[]

End If

Outcomes