Skip to main content
Participant
October 17, 2009
Question

How to solve this?

  • October 17, 2009
  • 2 replies
  • 582 views

I am a newbie in cold fusion.

Below are the 3 cold fusion page. Similar to MyPage.cfm, there are other tabs. Now the application has regular html controls.We haven't used any cf controls like cfgrid in our application. How Can I get <CFFORM> to make it work in this scenario and to use cfgrid?

If this is not possible, does regular html <form> can handle <cfgrid> feature.?

Can somebody help me out with this case?

tabsTop.cfm

<cfoutput>

<form action="post" action="SQL/#submitPage[SelectedTab]#" >

</cfoutput>

MyPage.cfm

<cfoutput>

</cfoutput>

tabsBtm.cfm

<cfoutput>

</form>

</cfoutput>

    This topic has been closed for replies.

    2 replies

    BKBK
    Community Expert
    Community Expert
    October 18, 2009
    does regular html <form> can handle <cfgrid> feature.?

    No. As Adam has said, cfgrid must be within <cfform>. You may of course use the HTML format, as follows

    <cfform format="html">

    <cfgrid format="html"></cfgrid>

    </cfform>

    tabsTop.cfm
    <cfoutput>
    <form action="post" action="SQL/#submitPage[SelectedTab]#" >
    </cfoutput>

    tabsBtm.cfm
    <cfoutput>
    </form>
    </cfoutput>

    The start tag <form> and closing tag </form> must be on the same cfm page. You may use cfinclude to include the page containing the start or end tag.

    How Can I get <CFFORM> to make it work in this scenario and to use cfgrid?

    The cfgrid documentation has an example you can run directly. It uses the datasource, cfdocexamples, which comes with Coldfusion.

    <!--- Query the database to fill up the grid. --->
    <cfquery name = "GetCourses" dataSource = "cfdocexamples">
        SELECT Course_ID, Dept_ID, CorNumber,
        CorName, CorLevel
        FROM CourseList
        ORDER by Dept_ID ASC, CorNumber ASC
    </cfquery>

    <h3>cfgrid Example 2</h3>
    <i>Currently available courses</i>
    <!--- cfgrid must be inside a cfform tag. --->
    <cfform format="html">
        <cfgrid name = "FirstGrid" format="html"
            height="320" width="580"
            font="Tahoma" fontsize="12"
            query = "GetCourses">
        </cfgrid>
    </cfform>

    Ananth405Author
    Participant
    October 18, 2009

    Thank you very much for the answers.

    Inspiring
    October 17, 2009

    You're going to need to revise your logic so that your <cfform> tags are within the same file.  CFML needs to be compiled before it's executed, so the CFML wihtin each file needs to be syntactically complete; one cannot rely on possible runtime considerations (like which files get included) during the compilation phase of proceedings.

    And, as you suspect, <cfgrid> controls need to be within <cfform> tags.

    The best way to answer questions like this is to give it a try and see what happens.  CF will not bite you if you get something wrong, so there's little risk in having a mess around with stuff.  It's a good way to learn.

    --

    Adam