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 8176373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:08:53+00:00 2026-06-06T23:08:53+00:00

I’ve used this example to set up a small object oriented project The page

  • 0

I’ve used this example to set up a small object oriented project

The page I’m redoing had some order features with a dynamic number of input fields (say sizes of an article, some size S-XL, some size S-5XL.

In Coldfusion fields where labelled dynamically like so:

<input type="button" name="qty#counter#" id="qty-field#counter#"

In my CFC, I’m listing all form fields like so:

<cfcomponent output="false" hint="">
   <cfscript>
     VARIABLES.Instance.Validation = {
         field_a="validation_criteria",
         field_b="validation_criteria",
         ...
         }
   </cfscript>
   <cffunction name="Defaults" access="public" returntype="struct" output="false" hint="">
      <cfscript>
      // form defaults
      var formDefaults = {
         field_a="", 
         field_b="",
     ...
         }
     </cfscript>
  <cfreturn formDefaults />     
</cffunction>

<cffunction name="Commit" ... do something with db

  <cfscript>                
var LOCAL = {};
    structAppend(defaultValues, VARIABLES.Instance.FormData);
    LOCAL.xxx = defaultValues;
  </cfscript>

  ... do stuff with LOCAL

So I’m creating an object with all passed form fields and do my stuff inside the CFC. Sort of like cfparam in non-object-oriented pages.

My question:
If I have 200 inputs on a page (easy…), I can’t possibly param them each 1-200 or extend my default by 200 inputs. So, my question: Is there an easier way to “param” dynamic number of form fields than to add dummy fields 1-500 and hope this is enough for all cases (which is the worst possible option…)

AND:
If I wanted to port this into MySQL… In Coldfusion I have a query like:

<cfoutput query="s">
    <cfquery datasource="db">
    UPDATE pos
    SET qty = "#evaluate("qty#id#")#"
    WHERE id = "#client_id#" and id = "#id#"
    </cfquery>
</cfoutput>

Is there any alternative than to loop in Coldfusion and call a storedProc i-numbers of times?

Thanks for input!

EDIT:
So my current solution looks like this:

 , ean1="", ean2="", ean3="", ean4="", ean5="", ean6="", ean7="", ean8="", ean9="", ean10=""
, ean11="", ean12="", ean13="", ean14="", ean15="", ean16="", ean17="", ean18="", ean19="", ean20=""
, ean21="", ean22="", ean23="", ean24="", ean25="", ean26="", ean27="", ean28="", ean29="", ean30="" 
, ean31="", ean32="", ean33="", ean34="", ean35="", ean36="", ean37="", ean38="", ean39="", ean40="" 
, ean41="", ean42="", ean43="", ean44="", ean45="", ean46="", ean47="", ean48="", ean49="", ean50="" 
, ean51="", ean52="", ean53="", ean54="", ean55="", ean56="", ean57="", ean58="", ean59="", ean60="" 
, ean61="", ean62="", ean63="", ean64="", ean65="", ean66="", ean67="", ean68="", ean69="", ean70="" 
, ean71="", ean72="", ean73="", ean74="", ean75="", ean76="", ean77="", ean78="", ean79="", ean80="" 
, ean81="", ean82="", ean83="", ean84="", ean85="", ean86="", ean87="", ean88="", ean89="", ean90="" 
, ean91="", ean92="", ean93="", ean94="", ean95="", ean96="", ean97="", ean98="", ean99="", ean100=""

// more
, menge1="", menge2="", menge3="", menge4="", menge5="", menge6="", menge7="", menge8="", menge9="", menge10=""
, menge11="", menge12="", menge13="", menge14="", menge15="", menge16="", menge17="", menge18="", menge19="", menge20=""
, menge21="", menge22="", menge23="", menge24="", menge25="", menge26="", menge27="", menge28="", menge29="", menge30="" 
, menge31="", menge32="", menge33="", menge34="", menge35="", menge36="", menge37="", menge38="", menge39="", menge40="" 
, menge41="", menge42="", menge43="", menge44="", menge45="", menge46="", menge47="", menge48="", menge49="", menge50="" 
, menge51="", menge52="", menge53="", menge54="", menge55="", menge56="", menge57="", menge58="", menge59="", menge60="" 
, menge61="", menge62="", menge63="", menge64="", menge65="", menge66="", menge67="", menge68="", menge69="", menge70="" 
, menge71="", menge72="", menge73="", menge74="", menge75="", menge76="", menge77="", menge78="", menge79="", menge80="" 
, menge81="", menge82="", menge83="", menge84="", menge85="", menge86="", menge87="", menge88="", menge89="", menge90="" 
, menge91="", menge92="", menge93="", menge94="", menge95="", menge96="", menge97="", menge98="", menge99="", menge100=""
};

So I’m unhappy but safe until my dynamic form spits out 100+ fields… If anyone know a less code-intensive way of setting up “param”/empty vars than the above, please chip in. Thx!

                                         , 
  • 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-06-06T23:08:55+00:00Added an answer on June 6, 2026 at 11:08 pm

    What’s wrong with doing the cfparam in a loop?

    <cfset numOfFields = 200>
    <cfset fields = "ean,menge">
    <cfloop list="#fields#" index="field">
        <cfloop from="1" to="#numOfFields#" index="i">
            <cfparam name="Form.#field##i#" default="">
        </cfloop>
    </cfloop>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used javascript for loading a picture on my website depending on which small
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
Basically, what I'm trying to create is a page of div tags, each has

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.