Jump to content

How the heck do I split a string to an array?


Guest mespinoza

Recommended Posts

Guest mespinoza

Okay, this is pretty ridiculous. I'm using ASP for the first time today, with jscript because I refuse to use anything with syntax as silly as vbscript. Anyway, I've learned quite a bit today (I started on client-side javascript yesterday, whee) and now I have run into a stupid problem.I'm trying to pass a string from one ASP to another so that I can store some database values. I have to use the HTML DOM to develop the values, so that has to be done client-side, so I am using a form (POST method) to do the server-side work. Simple enough, right? Ho ho ho.My strings are separated with the + character. That's simple enough. Unfortunately, I don't seem to be able to take them apart. I was trying to use the split method in java script:var fields = Request.Form("fields");var items = new Array();var items = fields.split('+');And I get:Microsoft JScript runtime error '800a01b6'Object doesn't support this property or method/admin/menuchange.asp, line 17 What? You mean, one of the most basic string processing methods, that's been in IE since version 4, isn't in whatever version of IIS came with XP? This is an exciting concept. So I poked around and found someone using split() in asp as a function. Okay, this is stupid, but an acceptable workaround, so I give it a shot:var fields = Request.Form("fields");var items = new Array();var items = split(fields,'+');Microsoft JScript runtime error '800a138f'Object expected/admin/menuchange.asp, line 17 Object expected? Where? Split can't possibly be looking for an object, it takes a string as an argument. It does the same thing if instead of putting the data into the variable "fields" and passing that to split, I just say split(Request.Form("fields"),'+') so I'm knid of at a loss here. Is it possible for a previous script on the page (I have some includes on every page) to cause this to happen? I tried changing the name of my string variable as well, and that didn't help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...