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

isdefined issue

Guest
Jun 20, 2008 Jun 20, 2008
Hello,

I just upgraded from cf5 to cf8. I have some code that was working but now isn't. Specifically I have a cfoutput query="xxxxxxx" and within that tag I have some IFs that use isdefined().

Example:
#isdefined("form.unitprice_"&trim(getprods.id))#

This used to evaluate to true but now evaluates to false. If I put the evaluated value above the cfoutput it does evaluate to true.

Further I even tried putting the evaluated value inside the cfoutput but it still does not work.

Example:
#isdefined("form.unitprice_1026")#

With debugging set to on I can see the different form fields that are returned on the page and they are there. Furthermore If I dump form.fieldnames I get the list that includes the ones in question.

I also noticed that I can reference the form fields without the "form." but only within the cfoutput.

Very weird. Any help would be greatly appreciated.

Thank you.
354
Translate
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

Deleted User
Jun 20, 2008 Jun 20, 2008
WHOA! Ok, figured out the problem. The table giving me the problem has a field named "form". I think referencing form fields by using "form.blahblah" within a cfoutput query that has a field named "form" is tripping up CF8 although it used to work in CF5. I'm going to rename that field.

Thanks
Translate
Engaged ,
Jun 20, 2008 Jun 20, 2008
That should work although you don't need the # signs if you are using cfif to check it is there. Can you post your code so we can offer more assistance?
Translate
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
Guest
Jun 20, 2008 Jun 20, 2008
Ok, very weird. I stripped the code down to the basics to see if I can reproduce the problem. If I do a simple query against the original table I can reproduce the problem. If I change the name of the table to another table, it does work. The code is below. The database is SQL server. Obviously the issue seems to be something in the database. However:
1. The code worked fine in CF5
2. In the code below I am not referencing any fields in the table
3. Both tables are rturning one record as per the MAXROWS setting

The table that doesn't work is named offerings2
The table that does work is named units

I've uploded to very simple pages with the code below and referencing both tables:
http://darkeffigy.com/test_offerings2.cfm
http://darkeffigy.com/test_units.cfm

--------BEGIN CODE--------
<CFQUERY NAME="getdata" DATASOURCE="#trim(user_datasource)#" USERNAME="#trim(dsn_uname)#" PASSWORD="#trim(dsn_pword)#" MAXROWS="1">
select * from offerings2
</CFQUERY>

<CFIF #isdefined("form.the_form_field")#>
<HR>ISDEFINED OUTSIDE THE CFOUTPUT<HR>
</CFIF>

<CFOUTPUT QUERY="getdata">
<HR>REGULAR ROW OF OUTPUT<HR>
<CFIF #isdefined("form.the_form_field")#>
<HR>ISDEFINED INSIDE THE CFOUTPUT<HR>
</CFIF>
</CFOUTPUT>

<FORM ACTION="test_offerings2.cfm" NAME="foreform" METHOD="POST" ENCTYPE="multipart/form-data">
<INPUT TYPE="text" NAME="the_form_field" VALUE="ABCDEFG">
<INPUT TYPE="submit">
</FORM>
--------END CODE--------

Thank you
Translate
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
Guest
Jun 20, 2008 Jun 20, 2008
LATEST
WHOA! Ok, figured out the problem. The table giving me the problem has a field named "form". I think referencing form fields by using "form.blahblah" within a cfoutput query that has a field named "form" is tripping up CF8 although it used to work in CF5. I'm going to rename that field.

Thanks
Translate
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