|
Could you post more of the code? The following runs fine on my IIS dev server (NT4 Server)...
Sub goodMSG(msg)
Dim badwords
badwords = Array("arse")
For i=0 To badwords.length
...
Next
End Sub
Jeremy L. Falcon<nobr>
Homepage : Sonork = 100.16311
"But everybody darlin' sometimes bites the hand that feeds."
"Remember in this game we call life that no one said it's fair."
"Just because you're winnin' don't mean you're the lucky ones."
Song: Breakdown - Album: Use Your Illusion II - Artist: Guns N' Roses
|
|
|
|
|
|
Hehe, I forgot to change to VB mode, but I figured it out when I noticed your return statements. I take it your coming from JScript, eh?
There is not a length property for an array object like in JScript. VB instead has two functions called LBound() and UBound() to find the lower and upper index bounds of the array.
Also, get rid of your return statements. To return a value you'll need to use a function and not a subroutine because subs don't return values by design. To return a value in VBScript and VB set the name of the function to the value just as you would a variable. To leave the function early you can call exit function .
Here's a short VB version of your function...
<%@ Language=VBScript %>
<%
Function GoodMsg(msg)
Dim badwords, temp
badwords = Array("arse", "a***hole")
' test the text before removing characters.
For i=0 To UBound(badwords)
temp = InStr(msg, badwords(i))+1
If temp > 1 Then
GoodMsg = False
Exit Function
End If
Next
' if we get here all went well
GoodMsg = True
End Function
' test the messages
Response.Write GoodMsg("Nice arse.")
Response.Write GoodMsg("Nice booty.")
%>
Jeremy L. Falcon<nobr>
Homepage : Sonork = 100.16311
"But everybody darlin' sometimes bites the hand that feeds."
"Remember in this game we call life that no one said it's fair."
"Just because you're winnin' don't mean you're the lucky ones."
Song: Breakdown - Album: Use Your Illusion II - Artist: Guns N' Roses
|
|
|
|
|
yep, i did come from Javascript, actually, i originally wrote the code in PHP, then converted it to javascript, now im converting it to VB.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "What goes up must come down. Ask any system administrator"
|
|
|
|
|
|
I was excited to see an autoComplete combobox in vb.net by Daryl on code project. I quickly began to try to reproduce the functionality in C# and on a web form. It went nowhere fast. No KeyUp event for dropdownlist, no Leave event for dropdownlist........ Has anyone managed to produce an autocomplete combobox for a web form? I am desperate.
|
|
|
|
|
If you're desperate...
http://www.dbcombo.net/
Not really an Autocomplete, more like an AutoSugguest.
I personally use an AutoCompleting combobox that depends only on IE5.5 DHTML so it doesn't really satisfy a c# requirment.
Depending on your target audience you could embed an inherited WinForms ComboBox, but that kind of goes in the direction of DHTML, no ASP.NET interaction.
|
|
|
|
|
Where did you get the dhtml. I have tried several things. I currently use the combobox that I believe is Forms 2.0 from Access.
|
|
|
|
|
Yeah I've used that one before... Pretty good except it works funky (I think all the controls in that library arent supported unless their hosted on an Office Style UserForm). Like after using the combobox you have to click buttons twice for the OnClick Event to fire.
Anyways this is a home-grown ComboBox implimented as an Element Behavior. I can email it to you if you'd like.
|
|
|
|
|
I would like. Seems I have tried that. The one I used worked good but when the page loaded, it flashed all the html to build the box. I have about 3000 entries.
|
|
|
|
|
|
Yes I did. Thank you very much. The code seems to be quite complex and I am not very fluent in behaviors. I have not gone thru it yet but hopefully I can do that this week. Thanks again. I still want to explore the C# server control solution but apparently not many people know the answer. I am very dissappointed that MS only provides ONE EVENT for the web form control. I cannot believe this is not possible. Any answers welcome. Thanks again Chris.
|
|
|
|
|
It's understandable to be dissapointed with the lack of events from the DropDownList and other web and html controls that ASP.NET expose, but then again its the nature of the environment. Every event that fires on server objects requires a postback. You could imagine how impractical it would be to make a round trip back to the server every time a user pressed a key or ran the mouse over a control.
|
|
|
|
|
I need to search a variable for a string, but do not know how. can someone help me.
oh, and does anyone know a good reference site of asp functions?
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "What goes up must come down. Ask any system administrator"
|
|
|
|
|
Try the InStr function.
A good reference site is the MSDN site(http://msdn.microsoft.com). For ASP/VBScript check out the Scripting section of MSDN (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vtoriVBScript.asp) or the Active Server Pages.
/WW
|
|
|
|
|
|
strReverse() should do it:
a = strReverse("ABC")
/WW
|
|
|
|
|
just one more question, how to remove any characters from the string that are not normal characters (e.g. a-z)
if you are wondering why I am asking all these Q's, is because I made some code in PHP, i converted it to Javascript for codeproject, and was gonna convert it to asp for codeproject, only problem is, I dont know any asp.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "What goes up must come down. Ask any system administrator"
|
|
|
|
|
|
I have copied the following code off phpbuilder.com but cannot find anything similar for stripping HTML comments...
I'm assuming the posix regex is the same across the board and was hoping someone out there in CP land (seeing how I don't seem to be getting answered at PHP sites) could possibly help me...
$buffer = eregi_replace("<script[^>]*>.*</script>","",$buffer);
Where is my regex going wrong in the comments stripping...?
Anyone help...thanx...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
Where is my regex going wrong in the comments stripping...?
I don't see anything wrong with it off the top of my head, but try escaping the exclamation mark just to be safe. And, of course, I'd like to know what you find out so I'll know for future reference.
Jeremy L. Falcon<nobr>
Homepage : Sonork = 100.16311
"But everybody darlin' sometimes bites the hand that feeds."
"Remember in this game we call life that no one said it's fair."
"Just because you're winnin' don't mean you're the lucky ones."
Song: Breakdown - Album: Use Your Illusion II - Artist: Guns N' Roses
|
|
|
|
|
Um, after looking at it again I did notice the regex for the comments is commented out! Maybe that's why it's not being pulled?
Jeremy L. Falcon<nobr>
Homepage : Sonork = 100.16311
"But everybody darlin' sometimes bites the hand that feeds."
"Remember in this game we call life that no one said it's fair."
"Just because you're winnin' don't mean you're the lucky ones."
Song: Breakdown - Album: Use Your Illusion II - Artist: Guns N' Roses
|
|
|
|
|
Thats just a typo...sorry...I forgot about that...
The comments don't exist in the actual source code...
The regex to strip JScript works great, so I figured i'd try and use the same syntax for comments...however what actually happens...i think is it finds the first comment
...Some Body HTML
<!-- comment -->
I'm very very new to regex, so I know nothing about whats going on...basically I just understand the concept...
Is there a repeat or counter character that shouldn't be there...???
Any ideas...?
Thanx in advance..
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
removes anything in between
OIC, try these expressions then...
$buffer = eregi_replace("(<script[^>]*</script>)", "", $buffer);
$buffer = eregi_replace("(<!--[^>]*-->)", "", $buffer); Brackets will match a sequence of characters, parenthesis will group characters, and nothing will match explicitly and can be considered as one big ol' group. I made the change to the script tag one too, because after realizing the issue I noticed it also had the same problem.
Hockey wrote:
I'm very very new to regex, so I know nothing about whats going on...
I'm not new to regex, and the complicated ones can still look like Chinese to me.
Jeremy L. Falcon<nobr>
Homepage : Sonork = 100.16311
"But everybody darlin' sometimes bites the hand that feeds."
"Remember in this game we call life that no one said it's fair."
"Just because you're winnin' don't mean you're the lucky ones."
Song: Breakdown - Album: Use Your Illusion II - Artist: Guns N' Roses
|
|
|
|
|
AFAIK the script removal code I used works fine...although I only tested it with ONE script tag present...I dunno if it works with 2 or more so it's a good thing you made me think about it...I'd better test it...
I'll definetly have to try yer version of the regex for stripping comments though...cuz i'm starting to loose my mind here...
Thanx alot...
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|