Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6040073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:27:41+00:00 2026-05-23T06:27:41+00:00

I would like to achieve something I can easily do in .net. What I

  • 0

I would like to achieve something I can easily do in .net.

What I would like to do is pass multiple URL parameters of the same name to build an array of those values.

In other words, I would like to take a URL string like so:

http://www.example.com/Test.cfc?method=myArrayTest&foo=1&foo=2&foo=3

And build an array from the URL parameter “foo”.

In .net / C# I can do something like this:

[WebMethod]
myArrayTest(string[] foo)

And that will build a string array from the variable “foo”.

What I have done so far is something like this:

<cffunction name="myArrayTest" access="remote" returntype="string">
    <cfargument name="foo" type="string" required="yes">

This would output:

1,2,3

I’m not thrilled with that because it’s just a comma separated string and I’m afraid that there may be commas passed in the URL (encoded of course) and then if I try to loop over the commas it may be misinterpreted as a separate param.

So, I’m stumped on how to achieve this.

Any ideas??

Thanks in advance!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:27:42+00:00Added an answer on May 23, 2026 at 6:27 am

    Well, if you’re OK with parsing the URL, following “raw” method may work for you:

    <cffunction name="myArrayTest" access="remote" output="false">
    
        <cfset var local = {} />
    
        <!--- parse raw query --->
        <cfset local.args = ListToArray(cgi.QUERY_STRING, "&") />
    
        <!--- grab only foo's values --->
        <cfset local.foo = [] />
        <cfloop array="#local.args#" index="local.a">
            <cfif Left(local.a, 3) EQ "foo">
                <cfset ArrayAppend(local.foo, ListLast(local.a, "=")) />
            </cfif>
        </cfloop>
    
        <cfreturn SerializeJSON(local.foo) />
    
    </cffunction>
    

    I’ve tested it with this query: ?method=myArrayTest&foo=1&foo=2&foo=3,3, looks to work as expected.

    Bonus. Railo’s top tip: if you format the query as follows, this array will be created automatically in URL scope ?method=myArrayTest&foo[]=1&foo[]=2&foo[]=3,3.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know whether something like this can be easily achieved, any
I would like to achieve something very similar to Microsoft Access query designer -
I would like to achieve something similar to how scala defines Map as both
I would like to achieve the following, I need to generate report for multiple
This is what I've got actually: http://jsfiddle.net/downloadtaky/P7jYU/ What I would like to achieve is
How can I achieve something like the following? public interface IGenericRepository { int id
I would like to achieve something like this: SELECT col1,col2-(SELECT foo FROM table1) FROM
I would like to achieve the following: I want a free Application Lifecycle Management
I would like to achieve the following: On homepage load, display modal box Within
I would like to achieve this functionality. <p:column> <p:commandLink value=prihlasit oncomplete=dlg.show(); action=#{signForProjectBean.setProjectForDetail(item)} /> </p:column>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.