Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 2nd, 2005, 08:17 AM
Authorized User
 
Join Date: Feb 2005
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kumarop
Default extracting @ from string

Dear sir,
   How I can confirm the presence of @ in email address say([email protected]).I want to varify the genuineness of email address.Only think in my mind is we can check presence of @ in given email.how you people do the same?

2) I want in a field all entry must be done in upper case only ,using upper function we can check it at runtime but can we set some attribute so that it can be check at entry time itself and make it in uppercase if user try to put in small one ?

Regards
Om Prakash

om prakash kumar
__________________
om prakash kumar
 
Old March 2nd, 2005, 03:49 PM
Authorized User
 
Join Date: Aug 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sherief Send a message via Yahoo to sherief
Default

Hi Om Prakash,

I used javascript to check email and check the uppercase entry, here is some simple example :
<script languange="javascript">
<!--
function validemail(email) {
        invalidChars = " /:"

        if (email == "") {
            return (false);
        }

        for (i=0; i < invalidChars.length; i++) {
            badChar = invalidChars.charAt(i)
            if (email.indexOf(badChar,0) != -1)
            {
                return (false);
            }
        }

        atPos = email.indexOf("@", 1)
        if (atPos == -1) {
            return (false);
        }

        periodPos = email.indexOf(".", atPos)
        if (periodPos == -1) {
            return (false);
        }

        if (periodPos + 3 > email.length) {
            return (false);
        }

        return (true);
    }

function uppercase()
{
key = window.event.keyCode;
if ((key > 0x60) && (key < 0x7B))
window.event.keyCode = key-0x20;
}

function checkform() {
if (!validemail(document.frmForm.txtEmail.value)) {
            alert("Email address is not valid.");
            document.frmForm.txtEmail.focus();
            return false;
        }
}
//-->
</script>

<form name="frmForm" method="post" action="[SOMEFILE]" onsubmit="javascript:return checkform();">
<input type="text" name="txtEmail" size="50"><br>
<input type="text" name="txtText" size="50" onkeypress="uppercase();”><br>
<input type="submit">
</form>

I hope this is enough...

Regards,
Sherief C. Mursyidi





Similar Threads
Thread Thread Starter Forum Replies Last Post
string extracting fraijo SQL Server 2000 4 October 25th, 2006 09:53 PM
Extracting Text Jeff Mason BOOK: Beginning Regular Expressions 1 October 24th, 2006 06:38 AM
extracting atributes - how to do this? zoreli XML 6 August 12th, 2006 03:46 AM
Extracting an Integer from a string gjc VB How-To 2 September 13th, 2005 03:50 PM
extracting last word of a string p_gauri7 Crystal Reports 1 January 3rd, 2005 09:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.