Why does parenthesis access notation work, but not the point?

I have a search form in ColdFusion. In the column, it calls the SQL stored procedure. It returns the first 20 matching entries by default and accepts the "pagenum" parameter (in addition to many other input parameters), which allows you to specify which set of 20 you would like to see (for pagination). For some reason, this code achieves the desired results:

<cfset form["pagenum"] = 3 />

So far this has no effect:

<cfset form.pagenum = 3 />

I got the impression that these two lines of code are exactly the same, and the only reason you want to use parenthesis notation is if you had unusual characters in a variable that are not valid in dotted notation, so why am I getting different results for these two lines of code?

(In case this matters, the stored procedure takes all the parameters in xml format and then parses them. We have a coldfusion function that we call to convert the arguments of struct - in this case form- to xml and pass it to the function.)

UPDATE:

I just noticed that when I use form.pagenum, the key in the structure is in upper case ( PAGENUM), and if I use the form ["pagenum] in lower case ( PAGENUM). It seems that if you add a value to the structure, the default key has an uppercase letter, and since XML is case sensitive, it may be that it discards the stored procedure ...

+4
source share
2
<cfset form.pagenum = 3 />

(PAGENUM), xml, PAGENUM.

<cfset form["pagenum"] = 3 />

.

+3

Coldfusion ? CF10 :

<CFDUMP var="#FORM#">
<cfset form["pagenum"] = 1 />
<CFDUMP var="#FORM#">
<cfset form.pagenum = 2 />
<CFDUMP var="#FORM#">

Output of three dumps

+2

Source: https://habr.com/ru/post/1523307/


All Articles