Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - How to include function in to checkform?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to include function in to checkform?

 Post Reply Post Reply
Author
SkIpErMan View Drop Down
Newbie
Newbie
Avatar

Joined: 18 June 2008
Location: Sweden
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote SkIpErMan Quote  Post ReplyReply Direct Link To This Post Topic: How to include function in to checkform?
    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  %>";
        }





Edited by SkIpErMan - 26 April 2009 at 11:05am
Back to Top
SkIpErMan View Drop Down
Newbie
Newbie
Avatar

Joined: 18 June 2008
Location: Sweden
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote SkIpErMan Quote  Post ReplyReply Direct Link To This Post 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...


Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post Posted: 26 April 2009 at 5:29pm
is this an ASP or Javascript question?
S2H.co.uk - WebWiz Mods and Skins

For support on my mods + skins, please use my forum.
Back to Top
SkIpErMan View Drop Down
Newbie
Newbie
Avatar

Joined: 18 June 2008
Location: Sweden
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote SkIpErMan Quote  Post ReplyReply Direct Link To This Post 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



Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.