[thelist] Part II: ASP, FSO, Replace

Michele Foster michele at wordpro.on.ca
Tue Feb 4 16:02:14 CST 2003


Awesome .. Thanks again Darren,

Here's the revised code .. a couple minor things I had to change from what
you wrote (* lines).

   if inStr(str_Citizenship, ",") > 0 then
      arrCitizen = split(str_Citizenship, ",")
*      for i = 0 to ubound(arrCitizen)
         strCombo = replace(strCombo, "<option value=""" & arrCitizen(i) &
""">","<option selected value=""" & arrCitizen(i) & """>")
      next
   else
*      strCombo = replace(strCombo, "<option value=""" & str_Citizenship &
""">","<option selected value=""" & str_Citizenship & """>")
   end if


Josh,

Thanks for your suggestion .. it was giving me an error ...
Response object, ASP 0106 (0x80020005) An unhandled data type was
encountered.

Which I think had to do with needing to specify the split character ","
instead of the default ";" .. but I didn't test it thoroughly as Darren's
suggestion is more complete.

Thanks again folks .. now to clean up and comment my code .. and build the
rest of the pages. ;)


Mich

----- Original Message -----
From: "darren" <darren at web-bitch.co.uk>

> how about splitting the string you get from the database on the separator
> and loop through the array doing the replace on each value??
>
> something like:
>
>    if inStr(str_Citizenship, ",") > 0 then
>       arrCitizen = split(str_Citizenship, ",")
>       for i = 0 to ubound(arrCitizen, 0)
>          strCombo = replace(strCombo, "<option value=""" & arrCitizen(i) &
""">",
>             "<option selected value=""" & arrCitizen(i) & """>")
>       next
>    else
>       strCombo = replace(strCombo, "<option value=""" & arrCitizen(i) &
""">",
>          "<option selected value=""" & arrCitizen(i) & """>")
>    end if





More information about the thelist mailing list