Forum Moderators: open

Message Too Old, No Replies

Update SQL database with Option Email Address

         

HQing

3:57 am on Jul 30, 2009 (gmt 0)

10+ Year Member



How to update SQL Database with optional Email address?

Example Update Staff Detail, when update staff email, the person update the email field will have the option, to update with an email address or update record without email address.
So how should i write in my javascript?

Using ASP Classic, javascript and class
language using: VB with ASP classic

My Data retrieve from recordset
<snip>
Thanks in advance.

[edited by: marcel at 8:28 am (utc) on July 30, 2009]
[edit reason] Removed excessive code dump [/edit]

marcel

8:29 am on Jul 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi HQing and Welcome to Webmasterworld [webmasterworld.com]!

One option for this is the add a checkbox by the email TextBox. If this is checked, update the email in the database, otherwise ignore it.

HQing

10:17 am on Jul 30, 2009 (gmt 0)

10+ Year Member



Can you show me an example of the scenario that you have mention.. Thanks

One option for this is the add a checkbox by the email TextBox. If this is checked, update the email in the database, otherwise ignore it.

marcel

11:53 am on Jul 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can add a CheckBox next to your email TextBox in the HTML, like so:
<input type="checkbox" name="chkUpdateEmail" value="1" />&nbsp;Update email address

And when saving the form values to the database, first check to see if the CheckBox has been checked:

If Request.Form("chkUpdateEmail") = 1 Then
' Update the email address
End If

HQing

6:10 am on Jul 31, 2009 (gmt 0)

10+ Year Member



So, how to check, because i have a textbox for the email field, so how to show the textbox when i click on the check with Email?

marcel

4:09 pm on Jul 31, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So, how to check, because i have a textbox for the email field, so how to show the textbox when i click on the check with Email?

I think I would use javascript [webmasterworld.com] for this, you can hide or show the TextBox on the checkbox click. But, I would also recommend doing a server side check also before saving to the database