469,090 Members | 1,310 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,090 developers. It's quick & easy.

how can I get my script to hold the correct info from the input box

How can I get my script keep the correct answers in the input box and have the person redo only the incorrect answers?

Expand|Select|Wrap|Line Numbers
  1. im MyString, MyArray, i, objRegEx, array, stransw1, strquit, Firstname, Lastname, Password, aMyString
  2. stransw1 = true
  3.  
  4. Do while stransw1 = true
  5.  
  6. MyString = Inputbox("please tell me your Firstname: Lastname: Password: PLEASE PLACE A COMMA BETWEEN EACH")
  7.  
  8.  
  9.  if Mystring = "" then 
  10.  strquit = msgbox ("Do you want to quit?", vbyesno)
  11.  if strquit = vbyes then
  12.  wscript.quit
  13.  end if
  14. end if
  15.  
  16.  MyArray = Split (MyString, ",")
  17.  
  18.  if UBound(MyArray) = 2 then
  19.  stransw1 = false
  20.  
  21.  Set RegEx = New RegExp                      'create regular expression.
  22. RegEx.pattern = "^([a-zA-Z]+)$"             'set pattern.
  23. Set Matches = RegEx.Execute(MyArray(0))     'execute the search
  24. if Matches.count = 0 then
  25. stransw1 = true
  26. Msgbox "First name can't contain special characters or numbers"
  27. end if
  28.  
  29. Set RegEx = New RegExp
  30. RegEx.Pattern = "^([a-zA-Z]+)$"
  31. Set Matches = RegEx.Execute(MyArray(1))
  32. if Matches.count = 0 then
  33. stransw1 = true
  34. Msgbox "Last name can't contain special characters or numbers"
  35. end if
  36.  
  37.  
  38. Set RegEx = New RegExp
  39. RegEx.Pattern = "[A-Z]" 
  40. Set Matches = RegEx.Execute(MyArray(2))
  41. if Matches.count = 0 then
  42. stransw1 = true
  43. Msgbox "Password must have Upper case letter"
  44. end if
  45.  
  46. Set RegEx = New RegExp
  47. RegEx.Pattern = "[a-z]"
Apr 5 '14 #1
0 768

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Joe Randstein | last post: by
5 posts views Thread by Shabam | last post: by
3 posts views Thread by =?Utf-8?B?UGF1bA==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.