Print Page | Close Window

How to include function in to checkform?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=27285
Printed Date: 29 March 2026 at 9:17am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: How to include function in to checkform?
Posted By: SkIpErMan
Subject: How to include function in to checkform?
Date Posted: 24 April 2009 at 12:59pm
Hi!

I have add a address field in the Web Wiz registration process. I use the function checkform to check for an address. That was not so hard to do and it works fine.

        //Check for a adress
        if (formArea.GatuAdress.value.length < 5){
                errorMsg += "\n\t<% = strTxtErrorGatuAdress  %>";
        }



I have field with birth date I want to include. The birth date is special in Sweden because we have also a personal security number to se if its realy you.

My own registration cod is diffrent from web wiz so Im not shure how to include an function in to the checkform or if I should. Im not shure how to solv this so any help would be nice.

The funktion looklike this and checks year, day, month and securitycode of 4 number. If its a real personal number.

Function CheckNumber(ByVal strNumber)
   ' deklarera variabler
   Dim lngSum, lngTemp, lngPos

   ' kontrollera formatet
   With New RegExp
      .Pattern = "^\d{2}-?\d{2}-?\d{2}-?\d{4}$"
      If not .Test(strNumber) Then
         CheckNumber = False
         Exit function
      End If
   End With

   ' ta bort eventuella bindestreck
   strNumber = Replace(strNumber,"-","")

   ' beräkna checksumman
   lngSum = 0
   For lngPos = 1 to 10
      lngTemp = CLng(Mid(strNumber, lngPos, 1)) * ((lngPos mod 2) + 1)
      If lngTemp > 9 Then lngTemp = lngTemp - 9
      lngSum = lngSum + lngTemp
   Next

   ' kontrollera checksumman
   CheckNumber = (lngSum mod 10) = 0
End Function



EDIT

My ide is something like this

        
        //Check for a personalnumber
        If NOT (CheckNumber(formArea.PersNummer)) {
        errorMsg += "\n\t<% = strTxtErrorPersNummer  %>";
        }






Replies:
Posted By: SkIpErMan
Date Posted: 26 April 2009 at 11:09am
That should do the trick but it dosent. Whats happen is The Web Wiz security messages displays only member have the rights...




Posted By: Scotty32
Date Posted: 26 April 2009 at 5:29pm
is this an ASP or Javascript question?

-------------
S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins

For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .


Posted By: SkIpErMan
Date Posted: 27 April 2009 at 11:48am
formArea is included in WebWiz forum register.asp page and it is a javascript.  Checknumer is not. But I do have another script in Java.  I usual use the code above in my asp pages with case "securitynumber": Response.Write. However there is security checks and WebWiz uses formArea to for the submit so I have to include Checknumber with the formArea.

But if you have another ide you are welcom to tell med!

/SkIpErMan






Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net