Question

CF8 CFLAYOUT causing "Error processing JavaScript" using Tabs

Asked by: OceanReefClub

I'm using the new CFLAYOUT tool with tabs.

i have 2 significant problems.

Every time I modify an item on one of the tabs, I get a javascript error.
    ("Error processing JavaScript in markup for element cf_layoutarea1200957169825: [Enable debugging.....]

Also, on page refresh the outer nav frame is duplicated, with the content inside of 2 navigational frames and the CFLAYOUT is broken so that the tabs format is no longer working.

any thoughts on what's happening??
thanks
JB

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-01-21 at 16:37:24ID23099875
Tags

Adobe

,

ColdFusion

,

CF8

Topic

Cold Fusion Markup Language

Participating Experts
3
Points
500
Comments
23

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. JavaScript Calculatopr Markup
    hello there, i am trying to add some javascript code in my html but i just cant get it done. i have 3 products that cost $2.00 dollars each one, and if they want to buy 500 will divide it by 20%, 8000 divide it by %30 and if they want 12000 for %40, and show the prince thats ...
  2. Invalid markup?
    I can't seem to find why my webpage is not valid, I get 3 errors: Error 1: ------------------------ document type does not allow element "form" here; missing one of "object", "applet", "map", "iframe", "ins", "...
  3. CF8 and Yelp API
    Hi All, Just wondering if anybody has done anything with the Yelp API in CF8? I'm working on searching for reviews for a business and showing them in a modal window. I'll share what I have so far - it doesn't work (returns a 'COLUMNS in undefined in CFDATA' error right now...
  4. PHP: Remove JavaScript events but leave markup
    I want to leave markup like <p> and <div> and <a> but I want to remove all JavaScript from the attributes. So <p style="border: 1px solid red" onclick="alert(555)">Hello</p> should become <p style="border: 1px solid ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: SBennettPosted on 2008-01-22 at 09:19:39ID: 20716111

did you use cfajax import to make sure all the javascript files for your cfform were imported on the main page?

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_a-b_2.html

 

by: SBennettPosted on 2008-01-22 at 09:22:40ID: 20716134

"cfajaximport" should be one word in the comment above.

And the nav being doubled is probably happening because the template you are binding to that tab is including your header and footer. If you can post a little code that would be easier to identify

 

by: OceanReefClubPosted on 2008-01-22 at 10:48:27ID: 20716979

good thought. I added that. no change in problem.

now it seems to draw a little slower, but the same errors yet persist.

it was a little tricky getting the paths right on that CFAJAXIMPORT tag
<CFAJAXIMPORT
    CSSSRC = "CFIDE/scripts/ajax/"
    SCRIPTSRC = "/CFIDE/scripts"
    TAGS = "cfdiv,cfform,cfgrid,cfinput-autosuggest,cfinput-datefield,cflayout-border,cflayout-tab,cfmenu,cftextarea,cftooltip,cftree,cfwindow">

what's happening is I have an editable form on each of the tabs. when i click a Submit button on any of the tabs, the page redirects to an action page (for database manipulation), then relocates to the tab again (in non-editable form). when i click the Submit button, i get a pop-up error reading "Error processing JavaScript in markup for element cf_layoutarea1201027352630....", but after I clear the error the page is redrawn.

Problem then is the page body also contains the outer nav includes.

 

by: SBennettPosted on 2008-01-22 at 11:09:31ID: 20717201

You shouldn't need to set the csssrc or scriptsrc attributes in your cfajaximport tag, and in your tags attribute you should only list the tags that will be used in the code that generates the content that gets bound to your tabs.  From the screen shot I would say you only need something like:

<CFAJAXIMPORT  TAGS="cfform">

and that tag needs to be put at the top of the template where your cflayout / cflayoutarea tags are.

Also, in the code that generates the form, you need to make sure your resulting html (the non-editable form) is not including the header or side navigation. Think of it as similar to how you would program a page that is within a frame, you only want that resulting page to return the HTML for the form.

 

by: gdemariaPosted on 2008-01-24 at 08:31:32ID: 20734481

Make sure you have separate files for your page and the contents of the tab.  It seems to me that you are calling your page to reload inside your tab.

Page.cfm

 contains call to CFAJAXIMPORT
 contains call to CFLAYOUT, with the source pointing to tabForm.cfm

TabForm.cfm

 does not contain CFAJAXIMPORT and does not contain CFLAYOUT (unles its a different one)
  contains only the contents of the tab, with the form.  
  This form submits and call TabFormDisplay.cfm

TabFormDisplay.cfm

 does not contain CFAJAXIMPORT and does not contain CFLAYOUT
 contains only the contents of the tab, with the read only display of the form.  

 

 

by: OceanReefClubPosted on 2008-01-24 at 08:59:12ID: 20734770

Sounds like you're onto something there, but I'm not sure what you mean "with the source pointing to tabForm.cfm".

here is the current code on the main page. The 3 tabs' content all comes from include files.

<CFAJAXIMPORT  TAGS="cfform">

<CFLAYOUT TYPE="TAB" TABHEIGHT="100%">

            <CFLAYOUTAREA TITLE="National Clubs"><CFINCLUDE TEMPLATE="dsp_update_otheraffiliationsupdate_national.cfm"></CFLAYOUTAREA>
            <CFLAYOUTAREA TITLE="ORC Club-within-Club"><CFINCLUDE TEMPLATE="dsp_update_otheraffiliationsupdate_ORC.cfm"></CFLAYOUTAREA>
            <CFLAYOUTAREA TITLE="Leadership Positions"><CFINCLUDE TEMPLATE="dsp_update_otheraffiliationsupdate_leaders.cfm"></CFLAYOUTAREA>

</CFLAYOUT>

 

by: gdemariaPosted on 2008-01-24 at 09:06:23ID: 20734864

Right, that's what I meant.  Some of the CF tags use the SRC parameter but this one doesn't..  Sorry for the confusion.

Now, when you submit   dsp_update_otheraffiliationsupdate_national.cfm  
what page do you call ?   Don't call the main page...

 

by: OceanReefClubPosted on 2008-01-24 at 09:11:22ID: 20734909

Actually I go to an action page where the data is inserted / updated, then the user is redirected back to the main page with a URL parameter stipulating the tab to be selected (as the one you were editing on).

but i'm trying your advice by using the SOURCE attribute of the CFLAYOUTAREA tag. means i have to move my queries to that include's page, as the queries don't seem to be retained and usable in the tab template. Also, my session variables don't seem to work in the tabs now.

<CFLAYOUT TYPE="TAB" TABHEIGHT="100%">
 
		<CFLAYOUTAREA TITLE="National Clubs" SOURCE="/public/members/pages/memberprofile/dsp_update_otheraffiliationsupdate_national.cfm"></CFLAYOUTAREA>
		<CFLAYOUTAREA TITLE="ORC Club-within-Club" SOURCE="/public/members/pages/memberprofile/dsp_update_otheraffiliationsupdate_ORC.cfm"></CFLAYOUTAREA>
		<CFLAYOUTAREA TITLE="Leadership Positions" SOURCE="/public/members/pages/memberprofile/dsp_update_otheraffiliationsupdate_leaders.cfm"></CFLAYOUTAREA>
 
</CFLAYOUT>
                                              
1:
2:
3:
4:
5:
6:
7:

Select allOpen in new window

 

by: gdemariaPosted on 2008-01-24 at 09:31:58ID: 20735142

when you submit within a layout tab, only the tab redraws.  So after your submit, you can't call the main page because you will be loading that page inside of the tab which is why you're getting the tabs within the tabs.

After the action page, just call the same page again to show it in the same tab.
dsp_update_otheraffiliationsupdate_national.cfm  

The tab will not need to be made active, you're already on it.  The page will not redraw, only the tab..

 

by: OceanReefClubPosted on 2008-01-29 at 07:00:08ID: 20768233

What I'm finding is that I redirect the form script back to the tab's .cfm file (being cfincluded by the parent file) and that does work to remain within the same navigational framework (and not double the nav). However, the session variables don't work (not found) even though they're sitting in the debugger area. The form variables seem to be available via CFDUMP, but not my session variables. Only once I refresh the page do the session variables become available to that tab's processing.

I built a sample app to show the problems here.

TRY THIS WITH THE CODE BELOW:
start on Tab3. click Edit Mode, which correctly remains on tab 3. submit any text, which is submitted to the Action.cfm page, an you are CFLOCATION'd back to Tab3. However at this point in MY application (of which we speak above), all session variables would be unavailable to code processing on tab3 right now (variable not defined error). Regardless, NOW click Edit Mode again (the second time) and note how screwy things get. You leave the CFLAYOUT framework and go directly to the tab's page.

I think CFLAYOUT has a fundamental bug that manifests when users are CFLOCATION'd back to a tab after processing. The only way I can think to fix this is to CFLOCATION back to the original page with the CFLAYOUT tag, and then (using URL params and CFIFs) decide which tab is "SELECTED". But when I do that, i get the Javascript error described above.

<!--- cflayouttest.cfm --->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cflayout test</title>
</head>
 
<body>
<CFAJAXIMPORT TAGS="cflayout-tab,cfform">
<CFLAYOUT TYPE="TAB" TABHEIGHT="100%">
 
		<CFLAYOUTAREA TITLE="TESTING Tab 1" SOURCE="cflayouttest-tab1.cfm"></CFLAYOUTAREA>
		<CFLAYOUTAREA TITLE="TESTING Tab 2"  SOURCE="cflayouttest-tab2.cfm"></CFLAYOUTAREA>
		<CFLAYOUTAREA TITLE="TESTING Tab 3" SOURCE="cflayouttest-tab3.cfm"></CFLAYOUTAREA>
 
</CFLAYOUT>
<br />
<br />
<font size="-2">
Note:If you use CFAJAXIMPORT and use CFFORM for the form tags, then you don't need to SELECTED the CFLAYOUTAREA tags, since CFFORM does it for you.
</font>
</body>
</html>
 
<!--- cflayouttest-actions.cfm --->
 
<h1>CF Layout Test - actions</h1>
 
<CFSWITCH EXPRESSION="#FORM.EDIT#">
 
	<CFCASE VALUE="SUBMIT-TAB1">
    
    	tab1
        
        <CFDUMP VAR="#FORM#">
        
        <CFLOCATION URL="cflayouttest-tab1.cfm">
        
    </CFCASE>
 
	<CFCASE VALUE="SUBMIT-TAB2">
    
    	tab2
        
        <CFDUMP VAR="#FORM#">
        
        <CFLOCATION URL="cflayouttest-tab2.cfm">
        
    </CFCASE>
 
	<CFCASE VALUE="SUBMIT-TAB3">
    
    	tab3
        
        <CFDUMP VAR="#FORM#">
        
        <CFLOCATION URL="cflayouttest-tab3.cfm">
        
    </CFCASE>
 
</CFSWITCH>
 
<!---cflayouttest-tab1.cfm--->
 
CF Layout Test - tab 1 body<br />
<br />
<CFPARAM NAME="FORM.EDIT" DEFAULT="VIEW MODE">
 
<CFIF form.edit EQ "VIEW MODE">
	VIEW-ONLY MODE<br /><CFFORM METHOD="POST"  ACTION="cflayouttest-tab1.cfm"><input type="submit" name="EDIT" value="EDIT MODE" /></CFFORM>
<CFELSE>
	EDIT MODE<br /><CFFORM METHOD="post" ACTION="cflayouttest-actions.cfm"><input type="submit" name="EDIT" value="SUBMIT-TAB1" /><input type="text" name="TESTBOX" /></CFFORM>
</CFIF>
 
<!---cflayouttest-tab2.cfm--->
 
CF Layout Test - tab 2 body<br />
<br />
<CFPARAM NAME="FORM.EDIT" DEFAULT="VIEW MODE">
 
<CFIF form.edit EQ "VIEW MODE">
	VIEW-ONLY MODE<br /><CFFORM METHOD="POST"  ACTION="cflayouttest-tab2.cfm"><input type="submit" name="EDIT" value="EDIT MODE" /></CFFORM>
<CFELSE>
	EDIT MODE<br /><CFFORM METHOD="post" ACTION="cflayouttest-actions.cfm"><input type="submit" name="EDIT" value="SUBMIT-TAB2" /><input type="text" name="TESTBOX" /></CFFORM>
</CFIF>
 
<!---cflayouttest-tab3.cfm--->
 
CF Layout Test - tab 3 body<br />
<br />
<CFPARAM NAME="FORM.EDIT" DEFAULT="VIEW MODE">
 
<CFIF form.edit EQ "VIEW MODE">
	VIEW-ONLY MODE<br /><CFFORM METHOD="POST"  ACTION="cflayouttest-tab3.cfm"><input type="submit" name="EDIT" value="EDIT MODE" /></CFFORM>
<CFELSE>
	EDIT MODE<br /><CFFORM METHOD="post" ACTION="cflayouttest-actions.cfm"><input type="submit" name="EDIT" value="SUBMIT-TAB3" /><input type="text" name="TESTBOX" /></CFFORM>
</CFIF>

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:

Select allOpen in new window

 

by: gdemariaPosted on 2008-01-29 at 07:26:49ID: 20768530

Thanks for the example I am playing with it now.

Question  -  where do you set and/or change your session variables in this code?  Or is it that the code just loses session variables that are set outside of this code ?

Also, if there is an error entered by the user on submit (such as not entering a field or entering an invalid date) how do you return to the form for them to fix it?   I ask this because you are hopping between pages and it seems they won't be able to.  One proposed fix I have for you would handle that scenario as well..

 

by: gdemariaPosted on 2008-01-29 at 07:31:32ID: 20768607

CFLOCATION has a known side-effect of not setting session variables.   But session variables already set (on a previous page display) should not be lost in a future cflocation.

Typically, you should call CFLOCATION with AddToken="No" so you are not exposing your session tokens on the URL.  

<CFLOCATION URL="cflayouttest-tab1.cfm"  addToken="no">

 

by: OceanReefClubPosted on 2008-01-29 at 10:44:24ID: 20770745

I'm using Fusebox3 framework, so session variables are set much earlier at a user login screen. thereafter they persist until the user leaves the site. so the session variables should be available to the tabs at all times. but they're not.

i think CF hasn't looped over the code yet, or hasn't refreshed quite right, or something odd.

the URL tokens shouldn't affect this situation I wouldn't think.

regarding form validation, i do it on the form using CFINPUT tag client-side validation

 

by: gdemariaPosted on 2008-01-29 at 11:48:48ID: 20771447

I looked through all my CF8 code and didn't find any cases where I use CFLOCATION within a CF Ajax object.   I really don't think you can do it.  CF Ajax objects are DIVs on the page and CFLOCATION is meant to redirect the page itself.   I think you need to use one of the Ajax objects provided such as Coldfusion.Navigate()


   <script>
     ColdFusion.navigate('newTemplate.cfm','myObject');
   </script>




 

by: OceanReefClubPosted on 2008-01-30 at 12:57:54ID: 20781203

I experimented a little with that, but that doesn't seem to be right. It navigates the template INTO the page you're in (i think), but i want to process the form variables (insert/update SQL), then return to and redraw the tab with updated data. I want the user to stay on the tab the whole time.  If I do the SQL processing on the tab itself, I still need to return to that tab (redrawn / repopulated as read-only).
i'm also confused about using CFLAYOUTAREA Source=  vs. using CFINCLUDE inside the body of the CFLAYOUTAREA tag. when i look at examples of code, the data is inside the tag, so why use the Source reference?

<CFAJAXIMPORT TAGS="cflayout-tab,cfform">
<CFLAYOUT TYPE="TAB" TABHEIGHT="100%">
 
<!---		<CFLAYOUTAREA TITLE="TESTING Tab 1" SOURCE="cflayouttest-tab1.cfm"></CFLAYOUTAREA>
		<CFLAYOUTAREA TITLE="TESTING Tab 2"  SOURCE="cflayouttest-tab2.cfm"></CFLAYOUTAREA>
		<CFLAYOUTAREA TITLE="TESTING Tab 3" SOURCE="cflayouttest-tab3.cfm"></CFLAYOUTAREA>
--->
		<CFLAYOUTAREA TITLE="TESTING Tab 1"><CFINCLUDE TEMPLATE="cflayouttest-tab1.cfm"></CFLAYOUTAREA>
		<CFLAYOUTAREA TITLE="TESTING Tab 2"><CFINCLUDE TEMPLATE="cflayouttest-tab2.cfm"></CFLAYOUTAREA>
		<CFLAYOUTAREA TITLE="TESTING Tab 3"><CFINCLUDE TEMPLATE="cflayouttest-tab3.cfm"></CFLAYOUTAREA>
 
</CFLAYOUT>
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:

Select allOpen in new window

 

by: OceanReefClubPosted on 2008-01-30 at 13:03:20ID: 20781269

maybe i should use a different tab tool. just thought the new CF8 stuff would be cool. i've looked everywhere about this and there seems to be problems submitting form variables inside of the tabs.  in this article:
<<http://www.coldfusionjedi.com/index.cfm/2007/6/7/ColdFusion-8-AJAX-UI-Tabs>> the question is similar to my situation: "Now can each tab submit it's form content via Ajax to a CFC that inserts it into a database? Maybe on each tab change submit that tabs data?"   Raymond Camden says: "First, AjaxLink lets you link and keep inside a layoutarea. Secondly, there is a ColdFusion.Ajax.submitForm JS function. "

tragically, i have no idea what he's talking about....

 

by: OceanReefClubPosted on 2008-01-30 at 13:11:26ID: 20781365

Ray Camden wrote me this: When you use cfform inside cflayout, the form post will be asynchronous. Therefore, cflocation doesn't make sense. Your doing an Ajax based request and the result is a header saying 'go here', but that doesn't make sense in this context. What you need to do instead is something like this:

Use ColdFusion.Ajax.submitForm() to submit the form. This will let you capture the result and handle it. In that result, you can then do whatever. If you want the tab contents to change, you can ColdFusion.navigate.

 

by: SBennettPosted on 2008-01-30 at 13:18:33ID: 20781445

Sounds like Ray told you to do exactly like what gdemaria said in his last post.  I agree that is the best solution. You don't want to use cflocation.

 

by: gdemariaPosted on 2008-01-30 at 18:15:40ID: 20783381

Ok, let me get really specific.  I modified your code and it works.



In your action template, replace the CFCASE for tab 1 with this...

<CFCASE VALUE="SUBMIT-TAB1">
         Tab1
        <CFDUMP VAR="#FORM#">
        <script>
         ColdFusion.navigate('cflayouttest-tab1.cfm','tab1');
        </script>
        <!--- <CFLOCATION URL="cflayouttest-tab1.cfm"> --->
    </CFCASE>


In your main template, add a tab NAME for each tab...
So you can refer to it by the navigate function..

<CFLAYOUT TYPE="TAB" TABHEIGHT="100%">
      <CFLAYOUTAREA name="tab1" TITLE="TESTING Tab 1" SOURCE="cflayouttest-tab1.cfm"></CFLAYOUTAREA>
      <CFLAYOUTAREA name="tab2" TITLE="TESTING Tab 2" SOURCE="cflayouttest-tab2.cfm"></CFLAYOUTAREA>
      <CFLAYOUTAREA name="tab3" TITLE="TESTING Tab 3" SOURCE="cflayouttest-tab3.cfm"></CFLAYOUTAREA>
</CFLAYOUT>

 

by: OceanReefClubPosted on 2008-01-31 at 11:17:34ID: 20789968

Thank you so much. This is great! I'm not using the ColdFusion.Ajax.submitForm function, but it's working with normal CFFORM submit. Here's the final code for posterity.

<!--- cflayouttest.cfm --->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>cflayout test</title>
</head>
 
<body>
<CFAJAXIMPORT TAGS="cflayout-tab,cfform">
<CFLAYOUT TYPE="TAB" TABHEIGHT="100%">
 
		<CFLAYOUTAREA NAME="tab1" TITLE="TESTING Tab 1" SOURCE="cflayouttest-tab1.cfm"></CFLAYOUTAREA>
		<CFLAYOUTAREA NAME="tab2" TITLE="TESTING Tab 2"  SOURCE="cflayouttest-tab2.cfm"></CFLAYOUTAREA>
		<CFLAYOUTAREA NAME="tab3" TITLE="TESTING Tab 3" SOURCE="cflayouttest-tab3.cfm"></CFLAYOUTAREA>
 
</CFLAYOUT>
</body>
</html>
 
<!--- cflayouttest-actions.cfm --->
<h1>CF Layout Test - actions</h1>
 
<CFSWITCH EXPRESSION="#FORM.EDIT#">
	<CFCASE VALUE="SUBMIT-TAB1">
    	tab1
        <CFDUMP VAR="#FORM#">
		<script>
         ColdFusion.navigate('cflayouttest-tab1.cfm?run=yes','tab1');
        </script>
    </CFCASE>
 
	<CFCASE VALUE="SUBMIT-TAB2">
    	tab2
        <CFDUMP VAR="#FORM#">
		<script>
         ColdFusion.navigate('cflayouttest-tab2.cfm?run=yes','tab2');
         </script>
    </CFCASE>
 
	<CFCASE VALUE="SUBMIT-TAB3">
    	tab3
        <CFDUMP VAR="#FORM#">
		<script>
         ColdFusion.navigate('cflayouttest-tab3.cfm?run=yes','tab3');
         </script>
    </CFCASE>
</CFSWITCH>
 
<!---cflayouttest-tab1.cfm    --->
CF Layout Test - tab 1 body<br />
<br />
<CFPARAM NAME="FORM.EDIT" DEFAULT="VIEW MODE">
<CFPARAM NAME="url.run" DEFAULT="no">
 
<CFIF form.edit EQ "VIEW MODE">
	VIEW-ONLY MODE<br /><CFFORM METHOD="POST" ACTION="cflayouttest-tab1.cfm?run=no"><input type="submit" name="EDIT" value="EDIT MODE" /></CFFORM>
 
<CFELSE>
	EDIT MODE<br /><CFFORM METHOD="post" ACTION="cflayouttest-actions.cfm"><input type="submit" name="EDIT" value="SUBMIT-TAB1" /><input type="text" name="TESTBOX" /></CFFORM>
    
</CFIF>
 
<CFIF url.run EQ "yes"><CFDUMP VAR="#FORM#"></CFIF>
<p>url.run = <CFOUTPUT>#url.run#</CFOUTPUT></p>
 
<!---cflayouttest-tab2.cfm--->
CF Layout Test - tab 2 body<br />
<br />
<CFPARAM NAME="FORM.EDIT" DEFAULT="VIEW MODE">
<CFPARAM NAME="url.run" DEFAULT="no">
 
<CFIF form.edit EQ "VIEW MODE">
	VIEW-ONLY MODE<br /><CFFORM METHOD="POST" ACTION="cflayouttest-tab2.cfm?run=no"><input type="submit" name="EDIT" value="EDIT MODE" /></CFFORM>
 
<CFELSE>
	EDIT MODE<br /><CFFORM METHOD="post" ACTION="cflayouttest-actions.cfm"><input type="submit" name="EDIT" value="SUBMIT-TAB2" /><input type="text" name="TESTBOX" /></CFFORM>
    
</CFIF>
 
<CFIF url.run EQ "yes"><CFDUMP VAR="#FORM#"></CFIF>
<p>url.run = <CFOUTPUT>#url.run#</CFOUTPUT></p>
 
<!---cflayouttest-tab3.cfm--->
CF Layout Test - tab 3 body<br />
<br />
<CFPARAM NAME="FORM.EDIT" DEFAULT="VIEW MODE">
<CFPARAM NAME="url.run" DEFAULT="no">
 
<CFIF form.edit EQ "VIEW MODE">
	VIEW-ONLY MODE<br /><CFFORM METHOD="POST" ACTION="cflayouttest-tab3.cfm?run=no"><input type="submit" name="EDIT" value="EDIT MODE" /></CFFORM>
 
<CFELSE>
	EDIT MODE<br /><CFFORM METHOD="post" ACTION="cflayouttest-actions.cfm"><input type="submit" name="EDIT" value="SUBMIT-TAB3" /><input type="text" name="TESTBOX" /></CFFORM>
    
</CFIF>
 
<CFIF url.run EQ "yes"><CFDUMP VAR="#FORM#"></CFIF>
<p>url.run = <CFOUTPUT>#url.run#</CFOUTPUT></p>
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:

Select allOpen in new window

 

by: gdemariaPosted on 2008-01-31 at 11:35:05ID: 20790140

You're welcome!  

I should explain, for future use perhaps.   The ColdFusion.Ajax.submitForm can asynchronously submit the form - which means when you click the button the page will not refresh, nor will the form itself.  Only the data will be passed to the server, behind the scenes.    You can also use the function to submit a form in another container, for example, when you click the tab, you could have the form automatically submit.

Just the regular submit button, the one you're using, can submit the form within the cfdiv, cflayout, cfgrid, etc containers.

Regards,

 

by: OceanReefClubPosted on 2008-02-01 at 07:22:02ID: 20797212

Since you've been so helpful and knowledgeable about CFLAYOUT, could you answer my question here too? It's related to what we discussed about regarding using session / query variables inside the tabs.

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/Cold_Fusion_Markup_Language/Q_23127557.html?cid=545

 

by: ckercherPosted on 2010-04-06 at 07:39:53ID: 29915192

Adding a cfgrid into this example causes another JS error, "Error processing JavaScript in markup for element tab1".  Even with cfgrid in the cfajaximport.  Here is the code I added inside the "view-only mode" section of tab 1...

<cfform name="testGrid" id="testGrid" action="##" method="post">
      <cfgrid name = "xmlGrid" format="flash" striperows="yes" width="100" height="100">
            <!---columns--->
            <cfgridcolumn name = "t1" header = "t1" type="string_noCase" dataalign="center">
            <cfgridcolumn name = "t2" header = "t2" type="numeric" dataalign="center">
            <!---data--->
            <cfloop from="1" to="2" index="i">
                  <cfgridrow data ="1,2">
            </cfloop>
      </cfgrid>
</cfform>

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...