CFDIV, and CFFORM not working right inside a CFWINDOW - coldfusion

Hey guys I am having an issue when I'm trying to display a cfdiv inside a cfwindow. It just doesn't show up. No errors, nothing to tell me I'm doing something wrong. The div works just fine if I display it in the page outside of the cfwindow. The cfdiv binds to a page that displays notes. If I try to do a cfinclude with the page the cfdiv binds to I get an error saying that the template can't be found, or there needs to be a mapping. I also have a cftext area inside a cfform and I'm trying to do richtext with it, however it doesn't work either inside of the cfwindow. Is cfwindow incapable of doing this, or is there a trick I don't know about. If you need any other information I'll be happy to provide it.
<cfdiv bind="url:/admin/notes/noteDiv.cfm?noteCategory=businessListing#url.listingID#" id="noteDiv">

On the page with the cfdiv you need to add:
<cfajaximport tags="cfform">
That will load up the required Javascript scripts to make cfform work within a window.

fully qualify your path and it will work. I just ran into this issue. I have a cfdiv inside a cfwindow
<cfdiv
id="idGoesHere"
name="nameGoesHEre"
style="height:300px;width:300px;display:none"
bind="url:http://serverName.att.com/folder/NotesTab_Ajax.cfm?Note_Tag_Type_Code={Tag_Note_Type#change}&case=buildAvailableTagList"
bindOnLoad="false"
/>
for some reason stepping the URL back a directory worked too ../folder/NotesTab_Ajax etc

Might need to pull in cfdiv from that cfAjaxProxy call as well.

Related

Display template for content search webpart issue for datatable and Tabs

I have developed display template and using it in Content search web part.
For displaying result on page i am using JQuery datatable/JQuery Tabs in display template.
Everything works fine, but sometime while loading page i am getting error like ("Object doesn't support property or method 'dataTable' (OnPostRender: )" and for tabs error is "Object doesn't support property or method 'tabs' (OnPostRender: )").
And if i refresh page many times then error will go and result is display as code.
I have register JQuery, JS and CSS using $includeScript.
I have also tried with RegisterSod for JQuery and JS file but still issue is same.
Thanks in Advance.
Can be:
This error usually occurs when an html element id has the same id as some variable in the javascript function, try change the name.
If you put the code I'll be able to help you better.
test = button.attr('test'); // Object doesnt support this method
$test= button.attr('test'); // works fine
Or debbug your code with and discover your problem. Enable script debugging IE:
In Internet Explorer, choose Internet Options from the Tools menu.
In the Internet Options dialog box, click the Advanced tab.
On the Advanced tab, under Browsing, clear Disable Script Debugging.
Click OK.
If you have IE 8+ click here
Tutorial Using jQuery dataTables: link here

Jquery inside of CFDiv

I have a page that includes a CFDiv tag that displays content from another file.
<cfajaximport tags="cfwindow,cfform,cflayout-tab,cfdiv">
<cfoutput><cfdiv class="vehicle-log" bind="url:trip_tab.cfm?ticketid=#ticketnum#" ID="theDiv" bindOnLoad = "true"/></cfoutput>
The external file has jquery tabs and jquery datepicker. None of the jquery seems to work in the CFDiv. If I call the external page by itself, everything works fine.
The reason I'm using a CFDiv here (I know most people hate cf layout stuff) is because the external page has a form element that I can submit and add to data to the db without refreshing the whole parent page. This is the only way I know how to do this.
Anyways, does anyone know how to get my jquery elements to work in a CFDiv?
Thanks.
Brian
You've got more than one problem here. First, you are using <CFDiv>, which under the covers is using portions of a very old version of ExtJS. So you are likely going to run into some headaches with mixing ExtJS and jQuery (and jQuery plugins).
Second, since <CFDiv bind="..."> uses AJAX to load the external HTML window content, you would need to change your JavaScript strategy. <CFDiv> will not pull in and execute the JavaScript code (including jQuery) from the external page (trip_tab.cfm), unless you only use CF UI widgets inside that external page (then the <cfajaximport> tag handles that for you). It only loads the HTML DOM content. You will have to move any <script> and <link rel="stylesheet"> tags and custom JavaScript/jQuery code and CSS into the parent page (the page that has the <CFDiv> tag in it). Then you'll have to find a way to listen for the AJAX event (completion of loading the external page) and call the custom JavaScript/jQuery code.
As others suggested in the comments above, using <CFDiv> is only making things harder for you. If you switched to using one JavaScript library for your UI components (like jQuery/jQueryUI/jQuery plugins), and put all of the necessary code into your main page, what you desire can be accomplished fairly easily.
I found a simple work around... CFdiv creates what feels like a seperate browser window, but its not actually one. So it can't pull Javascript files in via:
<script type="text/javascript" src="/js/scripts/jquery-1.11.1.min.js"></script>
The above is telling the browser "go fetch this file" - but since your CFdiv is not really a browser (Its a controversial permutation of CFajax as described here) it doesn't do it.
Technically, the above makes the browser include it into the page, just as if you cfincluded it , or just pasted the Javascript in there.
So convert the above to:
<script type="text/javascript"><cfinclude template="/js/scripts/jquery-1.11.1.min.js"></script>
And included javascript will work! (provided there aren't any conflicts with cfajax et al)
I had a similar problem in that my jquery was not working, and doing this fixed it.

Bigcommerce Templates file missing

I am developing a template for bigcommerce site, where i want to show category list and some hard code links in the place of Page menu. Now what i do, just place this %%Panel.SideCategoryList%% in the upper navigation area. Which shows category list right.
But the problem is that i didn't find this %%SNIPPET_SideCategoryList%% file. (In snippets folder exist a file with this name, but that file doesn't work even if i remove all contents of that file.)
I had a similar issue with SNIPPET_SideShopByBrandList.
I logged a ticket and got the following response:
Thank you for contacting BigCommerce technical support.
I see its reference in SideShopByBrand panel. In the same panel, there is another SNIPPET_ShopByBrandAllItem which is visible in snippets tree, but not this one. That's because its a hidden snippet, and its not possible to edit this.
I have tested this in my personal store as well, and the output is same. let me know if you have any other questions.
I think yours might also be a "hidden snippet and not possible to edit"
No worry....You need to just create html page and put the below code but keep one thing don't include the html, head, body etc
1) just create a html page and delete the html content
2) put the below my code for
3)
<li class="%%GLOBAL_LastChildClass%%">%%GLOBAL_CategoryName%%
%%GLOBAL_SubCategoryList%%
</li>

Mura tag/page content rendered backwards

hi guys,
I'm having bit of an issue with a Mura tag, I don't really use a lot of them but I have one in a page with some content underneath it but no matter what I do it renders below any content entered beneath it.
Is this normal? Is there a work around?
No, it's not normal. The Mura tag works similar to cfinclude. Output appears where you include it. I suspect that you have rather a HTML/CSS problem, than a Mura problem. Check your HTML source to see where the output actually shows up.

Importing HTML into TinyMCE using ColdFusion

Hey everyone, I would appreciate a pointing in the right direction with the problem I'm having. In short, I'm working on an application that will create PDFs using TinyMCE and ColdFusion 8. I have the ability to create a PDF by just entering in text, pictures, etc. However, I want to be able to import an html template and insert it into the TinyMCE .
Basically, I have a file directory code snippet that lets me browse through my 'HTMLTemplates' folder, and am able to select an HTML document. Now, I want to be able to take all the code from that selected HTML document and insert it into my TinyMCE box. Any tips on how I might do this, maybe?
Thanks!
If I understood you correctly, you already have a TinyMCE plugin which pops up a window and allows you to browse the certain directory using existing cfm page which you render within the popup window. Right?
If not, you should start with this. Not sure how easy it is done in current version, but in the older TinyMCE I've created the custom upload plugin (needed to track the site security permissions for current user) pretty quickly.
Next, I can see two quick ways to pass the server file contents to the client-side:
Make it available via HTTP so you can make the GET request and read contents into the variable.
Output it on the page using CF (say, on form submit when file selected) and grab using JavaScript.
I'd personally tried the second option. After you grab the text into the variable you can put it into the TinyMCE using it's API.
It can be as simple as output escaped text into the hidden div with known ID and read it using DOM operations (assuming that there is cfoutput around):
<div id="myTemplate">#HTMLEditFormat(myFileContents)#</div>
Also you can output the text directly into the JavaScript variable (of cource, with accurate escaping), maybe like this.
<script type="text/javascript">
var text = '#HTMLEditFormat(myFileContents)#';
</script>
Most advanced and possibly better for performance (and definitely "cooler") way is to use the concept of script tags as data containers, like this:
<script type="text/plain">
#HTMLEditFormat(myFileContents)#
</script>
Last time I've seen this in Nadel's blog, I think. Read it, pretty interesting.
Hope this helps.