How to get a form entry with index?

Guys:

I have a form and I submit data through this form. Upon clicking a submit button, I want to get the data that a user entered. Please review the following ColdFusion code to see what I mean:

for (i = 1; i LTE ArrayLen(cateNodes); i++) {
itemNodes = cateNodes[i].item;
for (j = 1; j LTE ArrayLen(itemNodes); j++) {
if (IsDefined(“FORM.submit_#i##j#”)) {
item = “FORM.item_” & i & j & “_sm”;
writeoutput(#item#);
}
}
}

This form has multiple submit buttons. Suppose that the “submit_ij” button is clicked, I want to be able to get the value that a user entered for item_ij_sm. For example, I want to get the value entered for

#FORM.item_21_sm#

Instead displaying the value that the user entered for item_21_sm, it displayed FORM.item_21_sm. And, I can see why it did that. It’s because FORM.item_21_sm is a string. It would have been very easy without the indecies.

I’m a ColdFusion newbie. Any recommendation is appreciated. Thanks a lot !

Thank you Sir. You are the man !

Assuming that the submit_ij button is the name of the submit button, you might be able to do this:

<!--- does the submit_ij button exist? --->
<cfif StructKeyExists(FORM, 'submit_ij') AND StructKeyExists(FORM, 'submit_ij_sm')>
    <cfoutput>#FORM['submit_ij_sm']#</cfoutput>
</cfif>

My pleasure. Glad it worked out for you.