iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > Classic ASP

Closed Thread
 
LinkBack Thread Tools
Old September 18th, 2003, 03:44 PM   #1
Reputable Member
 

Join Date: Sep 2003
Location: USA
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 jakyra is on a distinguished road
calling a javascript function in from VBscript

So I've got this validation code that does a complex enough function that I don't want to convert it to VBscript.

But now I need to do validation on an ASP page.

so I've got this fucntion in javascript:
IsISBN(isbn) {
some validation stuff with a boolean return
}

and from my page I want to do something like
Code:
<%
  myArray(3,1)
  for i = 0 to 3
    fieldname = "isbn" & i
    myArray(i, 0) = request.form(myField)
    myArray(i,1) = IsISBN (myArray(i,0))
  next 
  ...
%>
is this even remotely possible or am I stuck converting my validation function?

Thanks
jakyra
jakyra is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Old September 19th, 2003, 05:45 AM   #2
Rob
Elite Veteran
SuperMember
 
Rob's Avatar
 

Join Date: Jul 2003
Location: Southern UK
Age: 35
Posts: 3,131
Blog Entries: 7
Thanks: 28
Thanked 22 Times in 19 Posts
Rep Altering Power: 0 Rob is a jewel in the rough Rob is a jewel in the rough Rob is a jewel in the rough
I would just convert it.... why wouldn't you?

Anyway, after looking at how ISBN Validation works, I did this:-
Code:
Function CheckISBN(x)
	Length = Len(x)
	If NOT (Length > 10 Or Length = 0) Then 
		intValue = 0
		For Counter = 10 To 1 Step -1
			If Counter <= Length Then
        		intValue = intValue + (Counter * Mid(x, ((-1 * Counter) + Length + 1), 1))
	    	End If
		Next
		CheckISBN = (intValue Mod 11 = 0)

	Else
    		CheckISBN = False
	End If
End Function
I admit, I have not accounted for the X's that are allowed in ISBN numbers, and the function will fall-over if it comes across an X in an ISBN.... but hey, I didn't want to strip the entire challenge away from you!!

I've started you off, so just fill in the last bits!!

Rob
__________________
Rob - Webforumz Founder

I am currently NOT available for SEO consultancy work

My Sites: Student Midwife Forum, Costa Luz Holiday Rentals
Rob is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Old September 22nd, 2003, 07:13 PM   #3
Reputable Member
 

Join Date: Sep 2003
Location: USA
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 jakyra is on a distinguished road
'cause I'm lazy.

I was just wondering if there was an easy way to save myself some time.

Ahh well, on to the conversion board.

Thanks!
jakyra
jakyra is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Closed Thread

Bookmarks

Tags
calling , javascript , function , vbscript


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
calling functions in a function fatsurfer PHP 1 June 12th, 2008 05:53 PM
calling php function on click of a hyperlink csun PHP 2 July 15th, 2007 12:27 PM
problem calling function via onClick Eagle JavaScript 5 January 15th, 2007 05:41 PM
plz help me verify this... calling function melvinoyh JavaScript 0 May 28th, 2006 09:35 PM
Difficulty calling a javascript function? grittyminder JavaScript 4 July 21st, 2005 01:48 PM


Search Engine Optimization by vBSEO 3.2.0 RC8