CFGRID not populating with data after upgrade to CF9.0.1 - coldfusion

On CF9, this CFGRID worked fine, at least, it displayed fine (I had other issues with it).
After the update to 9.0.1, its completely blank. I even tried the hotfix, no change. I am dumping the query named "financedetails" above this code and it is showing data. Any ideas? Did cfgrid change substantially in 9.0.1? Or can I no longer use the query attribute for an html cfgrid?
<cfform action="financials.cfm?showid=#url.showid#" style="margin-top:15px;" method="post">
<cfinput type="hidden" name="showid" value="#url.showid#">
<cfgrid query="financedetails" name="finance_grid" format="html" selectmode="edit" insert="yes" delete="yes">
<cfgridcolumn name="Date" type="date">
<cfgridcolumn values="chargeid" name="chargeid" display="false">
<cfgridcolumn values="Setup Fee,blahh,blah,Custom Changes" name="Description">
<cfgridcolumn name="Amount">
<cfgridcolumn name="InvoiceDate" type="date">
<cfgridcolumn name="PaidDate" type="date">
<cfgridcolumn name="Notes">
</cfgrid>
<p><input type="submit" value="Save Changes"></p>
</cfform>

This might because coldfusion 9 was using ExtJs 3.0 which is upgraded to ExjtJs 3.1 for coldfusion 9.0.1.
Check following should resolve it.
If you just updated to 9.0.1 then it may possible that js taking from browser cache which is version 3.0 causing this issue. Try to clear browser cache and try again.
Make sure you are not not using dflat/gzip on server side if so then clear file from server as well.
If you modified grid to add header or footer then you need to look for compatibility. check http://www.cfminds.com/post.cfm/updating-coldfusion-9-0-0-to-9-0-1
To make sure correct version of extjs.js is downloading, open firebug script tab and check the source of extjs.js and look into comment it should say version 3.1.0 instead of 3.0.0.
I think above four check will solve your issue.
-Pritesh

Related

ColdFusion 10 cffile action="upload" accept attribute wildcards don't work

This code used to work fine with ColdFusion 9:
<cfif form.btnSaveImage EQ "Upload">
<cftry>
<cffile accept="image/*" action="upload" destination="C:\T" filefield="vcImageFile" nameconflict="overwrite">
<cfcatch type="Any">
<cfdump var="#cfcatch#" label="cfcatch">
</cfcatch>
</cftry>
</cfif>
<form action="<cfoutput>#cgi.SCRIPT_NAME#</cfoutput>" method="post" name="frmImagesAdd" id="frmImagesAdd" enctype="multipart/form-data">
<label for="vcImageFile">Image File*:</label><br>
<input type="file" name="vcImageFile" id="vcImageFile" size="40" maxlength="255" message="Image file is required to upload."><br>
<input type="hidden" name="btnSubmit" value="Add Image">
<input name="btnSaveImage" type="submit" value="Upload">
</form>
The issue is the accept="image/*" attribute of the cffile tag. In ColdFusion 9, this wildcard used to accept any file with a MIME type that started with "image/". In ColdFusion 10, I get the following error message:
"The MIME type or the Extension of the uploaded file image/jpeg was
not accepted by the server."
The MimeType value is "image/jpeg", so it should work with the wildcard.
I looked at the wikidocs for the cffile tag and it says this:
ColdFusion 10: Modifications to the attribute accept}}
However, it doesn't elaborate what those modifications are!
Looking at the upload action docs, it says that it will accept a comma delimited list of mime types. Does this mean that wildcards are no longer accepted?
FYI, this blog post has indicated the same problem same time last year:
http://www.cutterscrossing.com/index.cfm/2013/2/21/ColdFusion-10-File-Uploads-and-MIME-Types
Now, I remembered that there were changes to MIME type checking in CF
10, but I wasn't entirely sure. This code, written by one of our
developer's several months ago, would allow any "image" MIME type.
What we discovered is that we couldn't do this kind of wildcard
mapping under CF 10, that we now had to list out each accepted MIME
type as a comma delimited list.

Label in cfinput is displaying to the right of the text box

When working with Coldfusion 9 and cfform with a HTML format, I place a cfinput on a page with a label, it displays the label to the right of the text box. I have tried using the tag, with and without it but no matter what I do, the label is always to the right of the box.
<cfform method="post" name="mfForm" >
<label for="campaign">Mailfile ID:</label>
<cfinput type="text" name="campaign" id="campaign">
<cfinput type="submit" name="submit" value="Submit" id="submit">
</cfform>
Don't ever remember having this problem before recently. I would just use an HTML form, but want to take advantage of cf's autosuggest.
I hate to say it, but frankly quirks like this are why many people suggest ditching the built-in ajax features and using the underlying libraries (or some jQuery alternative) directly. You will have greater control, more choices, not to mention you will not be tied to whatever version ships with ColdFusion. Most of these libraries are updated frequently, so within a year the ones bundled with CF are often out of date. ExtJS is a good example. The public version is already up to version 4.2.1, but CF9 still uses 3.1.0.
Anyway, getting back to your question ... if you do a view source you will see CF generates several div tags, one of which contains the style="float:left" directive, which could explain the behavior you are seeing.
I did a quick search and happened upon a note in the the CF8 docs which suggest a hack for datefields which may also apply here:
To correctly display label text next to the control in both Internet Explorer and Firefox, you must surround the label text in a
<div style="float:left;"> tag and put three <br> tags between each
line.
Simply adding the div seems to work for me with the sample you posted:
<cfform method="post" name="mfForm" >
<div style="float:left;">
<label for="campaign">Mailfile ID:</label>
</div>
<cfinput type="text" name="campaign" id="campaign" autosuggest="AA,BBB,CCC,DDD">
<cfinput type="submit" name="submit" value="Submit" id="submit">
</cfform>
But again, you might want to consider using the javascript libraries directly instead of relying on the built-in ajax features, so you can avoid weirdness like this.

try to get my cfdiv to load on the same page

I have a page that provide some information and a cfselect tag.
<cfform name="selectrate" method="post" format="html">
<cfselect name="rateid" query="getrate" value="rateid" display="ratecode" />
</cfform>
<cfajaximport tags="cfform">
<cfdiv id="rateDiv" bind="url:testniva_3.cfm?rateid={rateid}" style="height:1500" bindonload="true">
For each rateid that is selected the cfdiv will call on testniva_3.cfm which provide information for that rateid. The testniva_3.cfm has a <cfsavecontent> tag that will calculate the grandtotal for the cfgrid in the same page. The testniva_3.cfm has this code:
<cfform name="display" format="flash">
<cfgrid name= "cart" query="getdtls" selectmode="edit" width="580">
<cfgridcolumn name="chargename" header="Charge Type" dataalign="right" select="No" >
<cfgridcolumn name="price" header="price"type="numeric" dataalign="right" select="No" >
<cfgridcolumn name="quantity" header="Quantity" type="numeric" dataalign="right" >
</cfgrid>
<cfinput type="Button" name="calculateBtn" value="Calculate Order" onclick="#calculateTotal#">
<cfinput type="Text" name="total" disabled="true" label="Total $" size="5">
</cfform>
The cfdiv seems to bind with the cfselect tag, because when I change the option in cfselect, the data in testniva_3.cfm page also changes, however, instead of remain on the page with all the information and the select option, it give me an error: Error processing JavaScript in markup for element rateDiv: [Enable debugging by adding 'cfdebug' to your URL parameters to see more information
then when I click OK, it refreshs the page and just give me the testniva_3.cfm page without all the information and select option of the main page. If I change the format of the cfgrid on the cfform in the testniva_3.cfm page to html, then the grid refresh the data without any problem, however, my <cfsavecontent>#calculateTotal# will not work with html format.
I am not sure what went wrong, and how to fix it. Any one have any ideas? I would really appreciated.
Thank you.

HTML form is sending valid content, but CF script is claiming to receive undefined values

I have a simple email form and CF script backing it. It should all be obvious, but the script is throwing up with valid input. I've verified that the expected values are in the header and I can output the values in the script, but it's not liking the values for anything beyond output.
This is my HTML:
<form id="email" name="email" method="post" action="scripts/email.cfm">
<fieldset>
<legend>Email Student Government:</legend>
<!-- PASS NAME (to query email) to the script -->
<input type="hidden" name="who" id="who" value="Example User">
<label for="from">Your Email:</label><br>
<input type="email" id="from" name="from"><br>
<label for="message">Message:</label><br>
<textarea id="message" name="message" rows="4"></textarea>
<input type="submit" name="send" id="send" value="Send Email">
</fieldset>
</form>
The ColdFusion (including debugging script at top):
<!--- member email addresses, hashed by name --->
<cfinclude template="emailHash.cfm">
<cfoutput>
#FORM.SEND#
#FORM.WHO#
#FORM.FROM#
#FORM.MESSAGE#
</cfoutput>
<cfif isdefined("FORM.SEND") and FORM.SEND eq "Send Email">
<cfmail from="Example User <example#example.com>"
to="#FORM.WHO# <#emailHash['FORM.WHO']#>"
bcc="Example User <example#example.com>"
replyto="#FORM.FROM#"
subject="Email Form Submission">
Message: #FORM.MESSAGE#
Date / Time Sent: #dateformat(now(), "yyyy/mm/dd")# at #timeformat(now(), "HH:mm:ss tt")#
</cfmail>
</cfif>
If I run the script, the logical output is printed, but then this error follows even though the FORM.WHO value is clearly defined and printed just fine in the output directly prior:
Element FORM.WHO is undefined in a CFML structure referenced as part of an expression.
I'm pretty annoyed at what I thought was an easy project so any nudges in the right direction would be greatly appreciated!
PS: I thought the HTML5 input types might be causing issues so I tried trading them for a plain text type, but that didn't do any good.
The problem isn't with your form variables, it's with this:
#emailHash['FORM.WHO']#
Your error is saying that that variables doesn't exist (the rest of the error message should point to the line number that that code is on? You didn't post that bit...). And from what you've posted, there's no evidence to suggest that it does.
What goes on in emailHash.cfm?

Passing values with a hidden CFInput

I am trying to make a table with editing capabilities, and I have run into problems trying to associate the old values with the updated ones. My solution was to include a hidden CFInput that passes the old value along side the one to be updated, and then the query is run within a cfc.
<cfform name="update" method="post">
<cfoutput query="allusers">
<tr>
<td>#username#</td>
<td>#email#</td>
<td>#securityID#</td>
<td>DELETE</td>
</tr>
<td><cfinput name="oldUsername" value="#username#" type="hidden"></cfinput><cfinput name="updateUsername" value="New Value"></cfinput></td>
<td><cfinput name="oldEmail" value="#email#" type="hidden"></cfinput><cfinput name="updateEmail" value="New Value"></cfinput></td>
<td><cfinput name="oldSecurityID" value="#securityID#" type="hidden"></cfinput><cfinput name="updateSecurityID" value="New Value"></cfinput></td>
<td><cfinput name="submit" type="submit"></cfinput>
<tr>
<cfdump var="oldUsername">
</cfoutput>
Currently I am not getting any errors, but it does not seem to be passing in the old values. Any tips?
Make sure your CFDUMP is using the hash tags:
<cfdump var="#oldUserName#">
otherwise it won't dump the contents of the variable.
Second of all, you are asking ColdFusion to evaluate "oldusername" when it hasn't had a chance to set oldusername for you yet. Using a CFINPUT tag, simply rewrites this in the HTML to a regular tag with JavaScript and/or Flash enhancements. So form.oldusername will only be available AFTER the post is executed to the next CF template/url. I also recommend highly that you scope (form., variables. etc...) your variables so things don't get crossed (unless you are carefully aware of the variable scope searching order)
Others have provide your answer. My answer is just advice about your form.
Your hidden cfinputs shouldn't be in a table. Tables are for displayed items. You'd be much better served to move your hidden cfinputs right under your cfform tag, like this:
<cfform name="update" method="post">
// NON DISPLAY STUFF
<cfinput name="oldUsername" value="#username#" type="hidden">
<cfinput name="oldEmail" value="#email#" type="hidden">
<cfinput name="oldSecurityID" value="#securityID#" type="hidden">
// DISPLAY STUFF
<table>
</table>
</cfform>