Skip to main content
Known Participant
February 4, 2008
Question

Any Ideas on how to change the Check New Username to work on an update form instead of an insert form

  • February 4, 2008
  • 2 replies
  • 332 views
Hi All,

I think I've attached the code below, which checks whether a Username already exists in the table, I've slightly ammended this, as i have a number of sites accesing the database, so i'm checking against the siteId also (you will see i have added the following code AND JBACASiteID = '1'") -

As I'm using the email address as the Username, and email addresses can change, I've given (or would like to) the user the option of changing their username, what I haven't done is applied the Check New Username behaviour to this.

Does anyone have any ideas as to how best to apply the Check New Username to the Update Record behaviour, and include the check against SiteID?

Many thanks
This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

Inspiring
February 5, 2008
I have modified the checkusername behavior for asp and the code will work, but not be editable with the DW wizard.
Just change the second line
' *** Redirect if username exists
MM_flag = "MM_insert"

TO:
MM_flag = "MM_update"

If you made your update for with the DW update record wizard there is a hidden field that is added. If its not
<input type="hidden" name="MM_flag" value="MM_Update" />
Then change the values in the code to whatever your form has.

GTN1707Author
Known Participant
February 5, 2008
Hi Mike,

Thanks for that, it worked nicely, mind if I ask another question, very similar -
I have a page (register.asp) with a Form (Form1) which posts the data to another page (afterregistration.asp), where a Stored Procedure inserts the data from register.asp into two tables.
The stored procedure works great, but as again here I have failed to check the the value which is being inserted into the Username field I am risking a dodgy login (the value is a textfield called email) the table and column that I need to check against is dbo.JBEmployee (table) JBEUserEmail and again I only need to check where the JBESiteID is the same as the siteid value posted by the form.

Is there anyway of checking this information on a Form Post, and if it does not redirecting to afterregistration.asp or if already exists redirecting to a registrationfailure.asp page?

Appreciate your help with this..

GTN