VBScript help

Results 1 to 6 of 6

Thread: VBScript help

  1. #1
    Christine Guest

    Default VBScript help

    Hello !!!<BR>I have this function to clean my strings. Here it is<BR><BR>&#060;Script language = "VBScript"&#062;<BR><BR>Function CensorStr(NaughtyString)<BR><BR>ExpletivesBAD = Array("cat","chicken","dog","horse","pig")<BR>Expl etivesCEN = Array("c*t","c*****n","d*g","h**se","#!#")<BR><BR> TotalExpletives = ubound(expletivesBAD)<BR><BR> for i = 0 to TotalExpletives<BR><BR> CENSOR = InStr (1, NaughtyString, ExpletivesBAD(i), 1)<BR> if CInt(CENSOR) &#062; 0 then<BR> NaughtyString = replace(NaughtyString," " & ExpletivesBAD(i)," " & ExpletivesCEN(i),1,-1,1)<BR> NaughtyString = replace(NaughtyString,ExpletivesBAD(i) & " ",ExpletivesCEN(i) & " ",1,-1,1)<BR> end if<BR> next<BR><BR> CensorStr = NaughtyString<BR><BR>End Function<BR>&#060;/script&#062;<BR><BR>Function works fine (I took it from one of the examples here)<BR><BR>But then I have a line that looks like this in my HTML code:<BR><BR>&#060;form method="POST" name = "form1" onSubmit = " return CensorStr("document.form1.comment.value");"&#062;< BR> <BR>But for some reason it doesnt clean the string. <BR>Can you please help me <BR>Any help is greatly appreciated.

  2. #2
    Rob Guest

    Default RE: VBScript help

    Try this...<BR><BR><form method="POST" name = "form1" onSubmit = " return CensorStr(document.form1("comment").value)"><BR><B R>Regards,<BR>Rob<BR><BR>

  3. #3
    Christine Guest

    Default To Rob with a smile

    Very funny ... you are invited to be a clown on my Christmas party

  4. #4
    rady Guest

    Default RE: VBScript help

    i have two questions.<BR>1. any error message<BR>2. what is the action parameter for the form?

  5. #5
    Steve Cimino Guest

    Default Interesting,,, Forum glitch?

    I received an error when trying to read your message, and couldn&#039t see anything between "try this" and "regards" (probably why the poster thought you were being funny). However, when I&#039m replying to it now, I can see the &#060;form method...&#062;<BR><BR>Doesn&#039t look like anything out of the ordinary that&#039s posted here every day.<BR><BR>Perhaps this is another case of the man trying to keep you down.

  6. #6
    Join Date
    Dec 1969

    Default RE: VBScript help

    Forgive my ignorance here....<BR><BR>First I&#039m curious about using client side vbscript... are you limited to IE-only browsers? (?netscape won&#039t run vbscript?)<BR><BR>Also I&#039m expecting to see something like:<BR>document.form1.comment.value = NaughtyString <BR><BR>in your code somewhere. It seems like you cleaned the string but aren&#039t sending it to the server at all (again my ignorance, but how is it supposed to get to the server?). <BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts