Validation vbscript to ASP

Thread Solved

Join Date: Jun 2007
Posts: 57
Reputation: Run.[it] is an unknown quantity at this point 
Solved Threads: 1
Run.[it]'s Avatar
Run.[it] Run.[it] is offline Offline
Junior Poster in Training

Validation vbscript to ASP

 
0
  #1
May 22nd, 2008
Im having problems with getting the page to stop progressing to the asp one when the user enters the text outwith the limits i.e. no data entered. Could anyone give any guidance?

Cheers

  1. <html>
  2. <head>
  3. <title></title>
  4.  
  5. <SCRIPT LANGUAGE="VBScript">
  6. dim validation
  7.  
  8.  
  9. Function MyForm_OnSubmit
  10. validation = False
  11.  
  12.  
  13. MyForm_OnSubmit = False
  14. If (Len(Document.MyForm.txtSurName.Value) > 12) Then
  15. MsgBox "You have entered more than 12 characters"
  16. validation = False
  17. End If
  18. If ((Document.MyForm.txtSurName.Value) = "") Then
  19. MsgBox "You have forgotten to fill in the input box"
  20. validation = False
  21. End If
  22. If (Len(Document.MyForm.txtSurName.Value) < 13) Then
  23. validation = True
  24. End If
  25. If (validation = True) Then
  26. MyForm_OnSubmit = True
  27. Else
  28. MyForm_OnSubmit = False
  29. End If
  30.  
  31. End Function
  32.  
  33.  
  34. </SCRIPT>
  35. </head>
  36. <body bgcolor = "lmonchiffon">
  37. <form name = "MyForm" action = "Validate.asp" method = "post" OnSubmit = "return validate(MyForm_OnSubmit)">
  38. <p>Enter Name</p>
  39. <input type = "text" name = "txtSurName" value = "">
  40. <input type = "submit" value = "Process">
  41. <input type = "reset" value = "reset">
  42. </form>
  43. </body>
  44. </html>
.........scaricamento.........
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 57
Reputation: Run.[it] is an unknown quantity at this point 
Solved Threads: 1
Run.[it]'s Avatar
Run.[it] Run.[it] is offline Offline
Junior Poster in Training

Re: Validation vbscript to ASP

 
0
  #2
May 23rd, 2008
value = "" needed to be initialised and the onSubmit isnt needed and it works a treat.

#
validation = True also needed at the start instead of False.
.........scaricamento.........
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 2123 | Replies: 1
Thread Tools Search this Thread



Tag cloud for ASP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC