Accessing Form Variables

We have a client that is posting to a cfc using jquery.   These are the form fields that we are getting from them

PORTLET_ORDERS[0][COLUMN]=0
PORTLET_ORDERS[0][ID]=panel_id_1
PORTLET_ORDERS[0][ROW]=0
PORTLET_ORDERS[1][COLUMN]=1
PORTLET_ORDERS[1][ID]=panel_id_2
PORTLET_ORDERS[1][ROW]=0
PORTLET_ORDERS[2][COLUMN]=1
PORTLET_ORDERS[2][ID]=panel_id_3
PORTLET_ORDERS[2][ROW]=1
PORTLET_ORDERS[3][COLUMN]=1
PORTLET_ORDERS[3][ID]=panel_id_4
PORTLET_ORDERS[3][ROW]=2

Open in new window


I feel like I am being stupid but if I want to get the column, id and row for PORTLET_ORDERS[3], how do I do that?   Something as simple as #evaluate("FORM.PORTLET_ORDERS[" & xx & "][ID]")# where xx is a cfloop index doesn't work - it says ID isn't defined which I get.
digitalwiseAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gdemariaCommented:
Never need to use evaluate...

Not sure what you are asking if it is beyond just the syntax....

this looks like an array of structures?   Except CF doesn't have a 0 element for an array, maybe start at 1?

<cfset theVAlue = FORM.PORTLET_ORDERS[0]["COLUMN"]>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
digitalwiseAuthor Commented:
So I did <cfset theVAlue = FORM.PORTLET_ORDERS[0]["ID"]>

This is the error I get from that:

Element PORTLET_ORDERS is undefined in a Java object of type class [Ljava.lang.String;.

Open in new window


This is the jquery that is posting

$("#draggable_portlets").sortable({
                connectWith: ".panel",
                items: ".panel",
                opacity: 0.8,
                coneHelperSize: true,
                placeholder: 'sortable-box-placeholder round-all',
                forcePlaceholderSize: true,
                tolerance: "pointer",
								update: function( event, ui ) {
									portlet_order = $("#draggable_portlets .panel").map(function() { 
									  return {
											id: this.id, 
											column: $(this).closest(".column").index(), 
											row: $(this).index() 
										}
									}).get();
									
									//console.log(ids_order);
									 
									$.post(
										"portlet_update.cfm", 
										{
											portlet_orders: portlet_order
										},
										function(data, textStatus, jqXHR) {
											console.log("success");
											console.log(data);
										})
							  },
            });

Open in new window


What I provided is the actual list of form fields/values that are being sent to the cfc.

FIELDNAMES=PORTLET_ORDERS[0][ID],PORTLET_ORDERS[0][COLUMN],PORTLET_ORDERS[0][ROW],PORTLET_ORDERS[1][ID],PORTLET_ORDERS[1][COLUMN],PORTLET_ORDERS[1][ROW],PORTLET_ORDERS[2][ID],PORTLET_ORDERS[2][COLUMN],PORTLET_ORDERS[2][ROW],PORTLET_ORDERS[3][ID],PORTLET_ORDERS[3][COLUMN],PORTLET_ORDERS[3][ROW]
0
gdemariaCommented:
I don't see a cfc, but if your code is inside a cfc function and the values are passed to it, then you should be checking the arguments scope

If this code is in side that  file  portlet_update.cfm, it looks like it is sending via GET, so the scope would be URL and not FORM.

You can dump the various scopes to see what values you have

<dump var="#url#">
0
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

digitalwiseAuthor Commented:
The code is inside a .js file.  They are definitely form variables.   If i do <CFSET LenPortals = #listlen(form.fieldnames)# / 3> - that works.  I just can't reference any of the fields.    What I posted first are the form fields and their values that show up.   The interesting thing is if I do a cfdump="#form#" - nothing shows up...  But I can see the form fields in the debugging output.  

Form Fields:
FIELDNAMES=PORTLET_ORDERS[0][ID],PORTLET_ORDERS[0][COLUMN],PORTLET_ORDERS[0][ROW],PORTLET_ORDERS[1][ID],PORTLET_ORDERS[1][COLUMN],PORTLET_ORDERS[1][ROW],PORTLET_ORDERS[2][ID],PORTLET_ORDERS[2][COLUMN],PORTLET_ORDERS[2][ROW],PORTLET_ORDERS[3][ID],PORTLET_ORDERS[3][COLUMN],PORTLET_ORDERS[3][ROW]
PORTLET_ORDERS[0][COLUMN]=0
PORTLET_ORDERS[0][ID]=panel_id_1
PORTLET_ORDERS[0][ROW]=0
PORTLET_ORDERS[1][COLUMN]=1
PORTLET_ORDERS[1][ID]=panel_id_2
PORTLET_ORDERS[1][ROW]=0
PORTLET_ORDERS[2][COLUMN]=1
PORTLET_ORDERS[2][ID]=panel_id_3
PORTLET_ORDERS[2][ROW]=1
PORTLET_ORDERS[3][COLUMN]=1
PORTLET_ORDERS[3][ID]=panel_id_4
PORTLET_ORDERS[3][ROW]=2

Open in new window

0
digitalwiseAuthor Commented:
This didn't really help but you can have the points.  I figured it out.
0
gdemariaCommented:
You should post the solution for others who maybe reading along, or see it in the future
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.