• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Dynamic Variables

New Here ,
Jul 10, 2006 Jul 10, 2006

Copy link to clipboard

Copied

I have an insert statement with a dynamic variable that I can not get to work. The dynamic variable is the form.judge_first_name.
Here is what I have so far: The judge_first_name field actually is going to have a number at the end of the name after each time though the loop. I want to reflect that in the insert statement.

<cfset num = form.number_of_elements>
<cfloop index="h" from="1" to="#num#">
<cfparam name="form.judge_first_name#h#" default="" type="any">

<cfquery name="insert_judge_first_name" datasource="#Application.DSN#">
INSERT INTO JUDICIAL_DIVERSITY_JUDGE (judgeid, stateid, judge_add_date, judge_first_name)
Values((#nextvalue#,
<cfqueryparam value="#form.stateid#" CFSQLType="CF_SQL_VARCHAR" maxlength="100">, sysdate,
<cfqueryparam value="#form.judge_first_name##h#" CFSQLType="CF_SQL_VARCHAR" maxlength="1000">)
</cfquery>
TOPICS
Advanced techniques

Views

408

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Jul 10, 2006 Jul 10, 2006
Try using this:

value="#form["judge_first_name#h#"]#"

Also, are you getting an error, or is it just not inserting a value?

Votes

Translate

Translate
Participant ,
Jul 10, 2006 Jul 10, 2006

Copy link to clipboard

Copied

Try using this:

value="#form["judge_first_name#h#"]#"

Also, are you getting an error, or is it just not inserting a value?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 10, 2006 Jul 10, 2006

Copy link to clipboard

Copied

Well its inserting into the table field the value judge_first_name1

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 10, 2006 Jul 10, 2006

Copy link to clipboard

Copied

So the cfqueryparm would look like this?

<cfqueryparam value="#form["judge_first_name#h#"]#" CFSQLType="CF_SQL_VARCHAR" maxlength="1000">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 10, 2006 Jul 10, 2006

Copy link to clipboard

Copied

Glad that worked for you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 10, 2006 Jul 10, 2006

Copy link to clipboard

Copied

LATEST
Close you need to alternate quotes, something like this:
<cfqueryparam value="#form['judge_first_name#h#']#"
CFSQLType="CF_SQL_VARCHAR" maxlength="1000">

OR a little cleaner way to do the same thing:
<cfqueryparam value="#form['judge_first_name' & h]#"
CFSQLType="CF_SQL_VARCHAR" maxlength="1000">



hlywd7 wrote:
> So the cfqueryparm would look like this?
>
> <cfqueryparam value="#form["judge_first_name#h#"]#" CFSQLType="CF_SQL_VARCHAR" maxlength="1000">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation