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

getHumansThisPlanet.cfc error

Explorer ,
Feb 18, 2011 Feb 18, 2011

I don't know if this is a bind problem or not - I'm not getting an error, I'm getting empty dropdowns on the form page. (The

cfc and cfm both reside in the same folder.) I've googled this planet and just can't find why the form selects aren't

dynamically loading from the cfc - What am I missing here? (This is based on Forte's cfc dynamic selects.)

Thanks for anyone's advice...

- e


********************* getHumansThisPlanet.cfc

<cfcomponent output="false">

    <cfset THIS.dsn="#application.dsn#">

    <!--- Get array of Places --->
<cffunction name="getPlanets" access="remote" returnType="array">
        <!--- Define variables --->
        <cfset var data="">
        <cfset var result=ArrayNew(2)>
        <cfset var i=0>

    <!--- Get Places --->       
<CFQUERY NAME="PlanetData" DATASOURCE="#THIS.dsn#">
SELECT DISTINCT PlanetNumber, PlanetName
FROM PlanetTable
     WHERE AdminLevel = 'three' AND PlanetYear = '2010-2011' AND ParticipationLevel = 'jumpingUpandDown'
     ORDER BY PlanetName ASC;
</cfquery>

    <!--- Convert results to array --->
        <cfloop index="i" from="1" to="#PlanetData.RecordCount#">
            <cfset result[1]=PlanetData.PlanetNumber>
            <cfset result[2]=PlanetData.PlanetName>
        </cfloop>

    <!--- And return it --->
        <cfreturn result>
    </cffunction>

    <!--- Get Humans by Planet --->
    <cffunction name="getHumans" access="remote" returnType="array">
        <cfargument name="PlanetNumber" type="numeric" required="true">

    <!--- Define variables --->
        <cfset var data="">
        <cfset var result=ArrayNew(2)>
        <cfset var i=0>
       
    <!--- Get data --->
        <cfquery name="HumanData" datasource="#THIS.dsn#">
        SELECT HumanID, PlanetNumber, Lname + ', ' + Fname AS FullName
        FROM HumanTable
        WHERE PlanetNumber = #ARGUMENTS.PlanetNumber#
        ORDER BY Lname ASC;
        </cfquery>

    <!--- Convert results to array --->
        <cfloop index="i" from="1" to="#HumanData.RecordCount#">
            <cfset result[1]=HumanData.HumanID>
            <cfset result[2]=HumanData.Fullname>
        </cfloop>

    <!--- And return it --->
        <cfreturn result>
</cffunction>

</cfcomponent>

********************* CFM page

<cfform action="EmailThisHuman.cfm" method="POST">
    <input type="hidden" name="SendTo" value="THIS Human THIS Planet">

  <tr>
    <td height="40" align="left" valign="middle" bgcolor="#FFFFFF"> </td>

    <td height="40" align="left" valign="middle" bgcolor="#FFFFFF">

    <span class="eleven_pt_bold_blue_ariel">Email THIS Human THIS Planet</span>

    <img src="transparent.gif" width="15" height="1" alt="spacer" />
   
                 <cfselect name="getPlanets"
                 message="------ Select Planet ------"
                 bind="cfc:getHumansThisPlanet.getPlanets()"
                 size="1"
                 onChange="document.getElementById('getHumans').style.visibility='visible'"
  bindonload="true" />
               
    <img src="transparent.gif" width="15" height="1" alt="spacer" />
               
                <cfselect name="getHumans"
                bind="cfc:getHumansThisPlanet.getHumans({FullName})"
                message="----- Select Human -----"
                style="visibility:hidden"
                id="getHumans"
                onChange="document.getElementById('HumanSubmitButton').style.visibility='visible'" />
               
    <img src="transparent.gif" width="15" height="1" alt="spacer" />
    
    <input type="submit" name="HumanSubmitButton" id="HumanSubmitButton" value="Submit" style="visibility:hidden" />

    </td>
    <td height="40" align="left" valign="middle" bgcolor="#FFFFFF"> </td>
  </tr>

</cfform>

2.9K
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
Community Expert ,
Feb 19, 2011 Feb 19, 2011

I can see only one error: you use 'Fullname' in

bind="cfc:getHumansThisPlanet.getHumans({FullName})"

whereas the first select field is named 'getPlanets'. In fact, to avoid confusion with the function name (which ColdFusion might also store in memory as a variable!), I would change the name of the first select field from 'getPlanets' to 'planet', and then use

bind="cfc:getHumansThisPlanet.getHumans({planet})"

If you still get no data, then test whether the queries are returning data as expected. To do so, create the page planetTest.cfm, containing the following code. Run it several times, for example, by simply refreshing the page. Do you continue to get data?


<!--- Get Places --->      
<cfquery name="planetData" datasource="#application.dsn#">
SELECT DISTINCT PlanetNumber, PlanetName
FROM PlanetTable
WHERE AdminLevel = 'three' AND PlanetYear = '2010-2011' AND ParticipationLevel = 'jumpingUpandDown'
ORDER BY PlanetName ASC;
</cfquery>

<cfif planetData.recordcount GT 0>
    <!--- pick the planet from a random row --->
    <cfset random_row_number = randRange(1, planetData.recordcount)
    <cfset random_planetNumber = planetData.planetNumber[random_row_number]>
    Random planet number: <cfoutput>#random_planetNumber#</cfoutput><br>

    <!--- Get data --->
    <cfquery name="HumanData" datasource="#application.dsn#">
    SELECT HumanID, PlanetNumber, Lname + ', ' + Fname AS FullName
    FROM HumanTable
    WHERE PlanetNumber = #random_planetNumber#
    ORDER BY Lname ASC;
    </cfquery>
    Random human data: <cfoutput>id=#HumanData.HumanID#; planetnumber=#HumanData.PlanetNumber#; fullname=#HumanData.FullName#</cfoutput>
<cfelse>
    The result set planetData contains no data!
</cfif>

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
Explorer ,
Feb 19, 2011 Feb 19, 2011

Thanks BKBK!

The "test" you posted worked just fine -- the queries do run. (Great test code - thanks - I'll use again for other things).

When I change the {Fullname} to {planet} (after renaming the first select to "planet") on my original form page code... I get a (narrow) blank dropdown... It's not binding to the cfc.

Thanks so much for looking into this. This is the first cfc I've tried to code... Want to get a handle on how the CF/Ajax works together and understand what's going on.

- e

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
Community Expert ,
Feb 19, 2011 Feb 19, 2011

Does the 'planet' select list get filled?

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
Explorer ,
Feb 19, 2011 Feb 19, 2011

Nope... The first select doesn't fill. I get a blank dropdown.

The queries run fine from the test code you sent... But, changing the select name (and same name in brackets of 2nd dropdown) on the form page -- no dynamic dropdown displays... just an empty dropdown.

The cfm and cfc are in the same folder...

Thanks again for your replies!

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
LEGEND ,
Feb 19, 2011 Feb 19, 2011

Do you have debugging turned on?  If so, on the first page load, can you see the query running from the cfc file?  Does it return records?

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
Community Expert ,
Feb 19, 2011 Feb 19, 2011

More suggestions

1) You should already have spotted that the following tag needs closing

<cfset random_row_number = randRange(1, planetData.recordcount)>

2) Use
<cfset result[1][1]="">
<cfset result[1][2]="------ Select Planet ------">
<cfloop query="PlanetData">
    <cfset result[currentrow+1][1]=planetNumber>
    <cfset result[currentrow+1][2]=planetName>
</cfloop>

instead of

<cfloop index="i" from="1" to="#PlanetData.RecordCount#">
    <cfset result[1]=PlanetData.PlanetNumber>
    <cfset result[2]=PlanetData.PlanetName>
</cfloop

3) Use
<cfset result[1][1]="">
<cfset result[1][2]="------ Select Human ------">
<cfloop query="HumanData">
    <cfset result[currentrow+1][1]=humanID>
    <cfset result[currentrow+1][2]=fullname>
</cfloop>

instead of

<cfloop index="i" from="1" to="#HumanData.RecordCount#">
    <cfset result[1]=HumanData.HumanID>
    <cfset result[2]=HumanData.Fullname>
</cfloop>

4) Use as the first select:
<cfselect name="planet"
                bind="cfc:getHumansThisPlanet.getPlanets()"
                size="1"
                onChange="document.getElementById('human').style.visibility='visible'"
          bindonload="true" />

5) Use as the second select:
  <cfselect name="human"
                bind="cfc:getHumansThisPlanet.getHumans({planet})"
                style="visibility:hidden"
                id="human"
                onChange="document.getElementById('HumanSubmitButton').style.visibility='visible'" />
               



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
Explorer ,
Feb 20, 2011 Feb 20, 2011

Thanks to all of you looking at this...

The queries do run. When I did the "test" from BKBK (see above - planetTest.cfm) this test page does pull the fields from the database.

I just tried BKBK's new code and I'm still getting the same result - a blank dropdown.

I do have de-bugging on and it's not throwing an error. The cfm page displays correctly - but the first dropdown is still empty.

For a fresh outlook... The following is the current code as per BKBK's latest suggestions... which is still not populating the select.

(The following is the original code -- "teacher" replaces "human" and "school" replaces "planet". I changed the field names in the original post in just trying to gain an understanding on how all this works instead of someone 'fixing my code' - I want to understand the whole process since this is my first try at building a cfc page. It was starting to get confusing to me to reword everything to run on the server.)

Thanks again, y'all...

- e


**************cfc

<cfcomponent output="false">

    <cfset THIS.dsn="#application.dsn#">

    <!--- Get array of Schools --->
    <cffunction name="getSchools" access="remote" returnType="array">
        <!--- Define variables --->
        <cfset var data="">
        <cfset var result=ArrayNew(2)>
        <cfset var i=0>

        <!--- Get Schools --->       
        <CFQUERY NAME="SchoolData" DATASOURCE="#THIS.dsn#">
SELECT DISTINCT
     schoolNumber, SchoolName
FROM
  teacher_logon
    WHERE AdmnLevel = 'tchr' AND SchoolYear = '2010-2011' AND ParticipationLevel = 'active'
    ORDER BY SchoolName ASC;
  </cfquery>

        <!--- Convert results to array --->
       
    <cfset result[1][1]="">
<cfset result[1][2]="------ Select School ------">
<cfloop query="SchoolData">
    <cfset result[currentrow+1][1]=schoolNumber>
    <cfset result[currentrow+1][2]=SchoolName>
</cfloop>

        <!--- And return it --->
        <cfreturn result>
    </cffunction>

    <!--- Get Teachers by School --->
    <cffunction name="getTeachers" access="remote" returnType="array">
        <cfargument name="schoolNumber" type="numeric" required="true">

        <!--- Define variables --->
        <cfset var data="">
        <cfset var result=ArrayNew(2)>
        <cfset var i=0>
       
        <!--- Get data --->
        <cfquery name="TeacherData" datasource="#THIS.dsn#">
        SELECT adminID, schoolNumber, Lname + ', ' + Fname AS FullName
        FROM teacher_logon
        WHERE schoolNumber = #ARGUMENTS.schoolNumber#
        ORDER BY Lname ASC;
        </cfquery>

        <!--- Convert results to array --->
       
    <cfset result[1][1]="">
<cfset result[1][2]="------ Select Teacher ------">
<cfloop query="TeacherData">
    <cfset result[currentrow][1]=adminID>
    <cfset result[currentrow][2]=Fullname>
</cfloop>

        <!--- And return it --->
        <cfreturn result>
    </cffunction>

</cfcomponent>

*****************cfm

<cfform action="EmailTeacherThisSchool.cfm" method="POST">
    <input type="hidden" name="SendTo" value="THIS Teacher THIS School">
  <tr>
    <td height="40" align="left" valign="middle" bgcolor="#FFFFFF"> </td>
    <td height="40" align="left" valign="middle" bgcolor="#FFFFFF">
    <span class="eleven_pt_bold_blue_ariel">Email THIS  Teacher THIS School</span>
    <img src="transparent.gif" width="15" height="1" alt="spacer" />
   
    <cfselect name="School"
                bind="cfc:getTeachersThisSchool.getSchools()"
                size="1"
                onChange="document.getElementById('Teacher').style.visibility='visible'"               
                bindonload="true" />
               
    <img src="transparent.gif" width="15" height="1" alt="spacer" />
               
                <cfselect name="Teacher"
                bind="cfc:getTeachersThisSchool({School})"
                style="visibility:hidden"
                id="Teacher"
                onChange="document.getElementById('TeacherSubmitButton').style.visibility='visible'" />
               
    <img src="transparent.gif" width="15" height="1" alt="spacer" />
    
    <input type="submit" name="TeacherSubmitButton" id="TeacherSubmitButton" value="Submit" style="visibility:hidden" />
    </td>
    <td height="40" align="left" valign="middle" bgcolor="#FFFFFF"> </td>
  </tr>
  </cfform>

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
Community Expert ,
Feb 20, 2011 Feb 20, 2011

I finally decided to run your code. When I put the following 2 files in a test directory, the test CFM file ran as expected.

My database server is MySQL 5. Also, note the use of   <cfset result[1][1]="0"> in place of  <cfset result[1][1]="">. That is because this value is the default option which the bind sends as an argument to the getHumans() function.  The function requires a numeric argument.

getHumansThisPlanet.cfc

<cfcomponent output="false">

    <cfset THIS.dsn="cfmx_db">

    <!--- Get array of Places --->

<cffunction name="getPlanets" access="remote" returnType="array">
        <!--- Define variables --->
        <cfset var data="">
        <cfset var result=ArrayNew(2)>
        <cfset var i=0>

    <!--- Get Places --->      
    <CFQUERY NAME="PlanetData" DATASOURCE="#THIS.dsn#">
    SELECT DISTINCT PlanetNumber, PlanetName
    FROM PlanetTable
    ORDER BY PlanetName ASC;
    </cfquery>
   
        <!--- Convert results to array --->
    <cfset result[1][1]="0">
    <cfset result[1][2]="------ Select Planet ------">
     <cfloop query="PlanetData">
        <cfset result[currentrow+1][1]=planetNumber>
        <cfset result[currentrow+1][2]=planetName>
    </cfloop>
      <!--- And return it --->
        <cfreturn result>
    </cffunction>

<!--- Get Humans by Planet --->
<cffunction name="getHumans" access="remote" returnType="array">
    <cfargument name="PlanetNumber" type="numeric" required="true">

    <!--- Define variables --->
        <cfset var data="">
        <cfset var result=ArrayNew(2)>
        <cfset var i=0>
      
    <!--- Get data --->
        <cfquery name="HumanData" datasource="#THIS.dsn#">
        SELECT HumanID, PlanetNumber, concat(Lname , ', ' , Fname) AS FullName
        FROM HumanTable
        WHERE PlanetNumber = #ARGUMENTS.PlanetNumber#
        ORDER BY Lname ASC;
        </cfquery>

    <!--- Convert results to array --->
    <cfset result[1][1]="0">
    <cfset result[1][2]="------ Select Human ------">
    <cfloop query="HumanData">
        <cfset result[currentrow+1][1]=humanID>
        <cfset result[currentrow+1][2]=fullname>
    </cfloop>
   
    <!--- And return it --->
    <cfreturn result>
</cffunction>

</cfcomponent>

test.cfm

<cfform action="EmailThisHuman.cfm" method="POST">
    <input type="hidden" name="SendTo" value="THIS Human THIS Planet">
  <tr>
    <td height="40" align="left" valign="middle" bgcolor="#FFFFFF"> </td>
    <td height="40" align="left" valign="middle" bgcolor="#FFFFFF">
    <span class="eleven_pt_bold_blue_ariel">Email THIS Human THIS Planet</span>
<br>
                 <cfselect name="planet"            
                 bind="cfc:getHumansThisPlanet.getPlanets()"
                 size="1"
                 onChange="document.getElementById('human').style.visibility='visible'"
  bindonload="true" />            
   <br>             
                <cfselect name="human"
                bind="cfc:getHumansThisPlanet.getHumans({planet})"
                style="visibility:hidden"
                id="human"
                onChange="document.getElementById('HumanSubmitButton').style.visibility='visible'" />
              
<br>
   
    <input type="submit" name="HumanSubmitButton" id="HumanSubmitButton" value="Submit" style="visibility:hidden" />

    </td>
    <td height="40" align="left" valign="middle" bgcolor="#FFFFFF"> </td>
  </tr>
</cfform>

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
Community Expert ,
Feb 20, 2011 Feb 20, 2011

Is there a mapping to C:\ColdFusion9\wwwroot\CFIDE in the ColdFusion Administrator? Does this directory exist: C:\ColdFusion9\wwwroot\CFIDE\scripts\?

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
Explorer ,
Feb 20, 2011 Feb 20, 2011

Thanks, BKBK...

Maybe that's the problem.

It does seem that everything is set up fine and the queries are actually pulling data when a test is run.

This is on a website hosted on a shared server. I understood that there was no special mapping if the cfm and cfc was in the same folder.

Do I need to set up a CFIDE/script folder in the root with mapping pointing to it to run a cfc? (This is a CF website at Intermedia dotnet)

- e

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
Explorer ,
Feb 21, 2011 Feb 21, 2011

Thanks again to everyone responding here... especially BKBK who's gone to great lengths in helping me...

This is got to be some kind of bind issue. The test cfm is working just fine, so the queries do run. The selects just do not fill when the cfm calls to the cfc page.

I didn't think mapping would be an issue here since I've read that a cfm and cfc doesn't have to have any special mapping if they are both in the same folder. Is this correct?

But this does seem to be some kind of bind issue since the test cfm runs just fine...

- e

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
Community Expert ,
Feb 21, 2011 Feb 21, 2011

Nessmuk wrote:

Do I need to set up a CFIDE/script folder in the root with mapping pointing to it to run a cfc?

Yes. The bind attribute requires ColdFusion's AJAX features, some of whose scripts are stored in the CFIDE/scripts folder.  If you know what the path is to the scripts folder, you can import it using the cfAjaxImport tag, something like

<cfajaximport scriptsrc="/someDir/scripts" tags="cfform">

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
Explorer ,
Feb 21, 2011 Feb 21, 2011

BKBK,

Thank you soooo much for your help!

At Intermedia dotnet, I found the following in the Knowledge Base:

ColdFusion Mappings
  If your hosting plan supports ColdFusion and you want to add or delete logical aliases for paths to directories on your server, please login to HostPilot Control Panel and navigate to the "Web/FTP Server > Web Server > Website Tools > ColdFusion > Mappings" page.

ColdFusion mappings apply only to pages processed by the ColdFusion Server with the cfinclude and cfmodule tags. If you save CFML pages outside of the D:\FTP\Username\Htdocs Web root (mapped to "/"), you must add a mapping to the location of those files on your server.?

I did try and set up a mapping to the cfc (I actually set up a cfcFolder and changed the dot notation on the form page to point to the cfc there). The mapping didn't help, although (per the above note at Intermedia), somewhere on one of the pages it must need a cfinclude or cfmodule... Can you point me in the right direction here... Am I hitting around the solution, finally?

Thanks again, BKBK. It is so great for someone to help a novice like this.

- e

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
Community Expert ,
Feb 22, 2011 Feb 22, 2011

Ask Intermedia dotnet to give you the path to the directory CFIDE! Still in that connection, what do you get when you run this code:

<cfdirectory action="list" directory="#expandpath('/')#" name="rootDir">
<cfoutput query="rootdir">
#name#<br>
</cfoutput>

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
Explorer ,
Feb 22, 2011 Feb 22, 2011

Hi BKBK,

Thanks again for continuing this...

The test you just sent points to the files in the root (under Htdocs).

I have this server space at intermedia dotnet where I've had a site for the last 10 years. This site resides in the root. I also have several sub-domains that I host -- all in their own folders and sub-folders under the root. There is a redirect on the "default" page that resides in the root that redirects to each of these separate sites.

So. That's the reason I'd like to have a cfc folder containing cfcs within the separate sub-domains - instead of in the root.

Also... After googling today, I just found out that there can be a conflict with an Application.cfm.

I do have an Application.cfm on this website (the code above) but, this Application cfm is in a folder one level up. In otherwords, I've been trying to make this cfc code work with the cfm - either both in the same folder or with the cfc in a folder inside the folder where the cfm form resides. In either of these places it should read the cfc before it hits the Application cfm since the Application cfm is a whole level up in the heirarchy. Right?

The kink I see is in how the hosting server says to do this... A mapping to the cfc and then to use either cfinclude or cfmodule.

I tried to set up this mapping as follows:

physical directory:
d:\ftp\mywebsite\Htdocs\newWebsite\admin\level2\cfcFolder

logical path:
/getTeachersThisSchool.cfc

But.... I don't know where to set up a cfinclude to (maybe) make this work. (As per the preceeding post on Intermedia dotnet's requirements for cfc mapping and, using either cfinclude or cfmodule.

Also, as a test, I put the cfc in the root but this doesn't work since from what I understand it's reading the application cfm and stopping there before it gets to the root to read the cfc when the cfc is in the root.

I know I should learn how to do away with Application.cfm and move on to Application.cfc but, this is an existing client site where everything else runs just fine. I hate to make major changes just yet here.

I'm just wanting to get some dynamic dropdowns working for a new admin section and the cfc seems to be the answer... It's just very confusing to me... as in this instance.

Thanks for your input, BKBK!

- ed

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
Community Expert ,
Feb 23, 2011 Feb 23, 2011

You indeed have to ask Intermedia dotnet to give you the path to the CFIDE or CFIDE/scripts/ directory!

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
Explorer ,
Feb 24, 2011 Feb 24, 2011

BKBK,

I've been back and forth with emails to and from Intermedia and can't get a clear answer on mapping to a sub-folder instead of using the root, which is in Htdocs... and I'd really like to have the cfc in a folder withing the sub-domain's folders instead of the very root of my server space.

Here's the reply I got on scripts:

CF scripts have access to /cfide and below (cfide/scripts) through "cfide" virtual directory created under your Htdocs folder in IIS. Also, permissions are granted through your sandbox security configuration (in CF Admin).

The CF scripts can be placed anywhere under your /Htdocs directory. The extensions *.cfm and *.dbm are mapped to CF script engine

Does this shed any light?

Thanks for your patience on this BKBK. You've been most generous with your time and I do appreciate it. I know We Both want to put this one to rest!

- ed

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
Community Expert ,
Feb 24, 2011 Feb 24, 2011

That indeed sheds some light. I don't think there's ever been any problem with the location of your CFC. Rather with the location of CFIDE/scripts/.

Your provider has clarified that now. So, let the experiment begin. Place the path(to the scripts directory) he/she has just described into the cfajaximport tag(as explained in previous post).

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
Explorer ,
Feb 25, 2011 Feb 25, 2011

Forever thanks, BKBK...

I think we're hitting around the problem now. With this my first cfc and, trying to set it up in a hosted environment, evidently my lack of knowledge of Ajax and virtual script directory is what's throwing all this off. I've searched the help files on the host and googled this issue in hope that this particular post would show the problem solved. (fingers crossed for next post).

My hosted plan does include CF Enterprise Edition -CFMX 8. I understand about the virtual directory CFIDE path now. I set up the cfajaximport scriptsrc as in your previous post, pointing to the script directory and and tried placing this tag on the cfm form page - first trying above the cfform and then within the cfform. I get an error both times: "tag starting with 'CF' has been detected. This tag is not supported by this version of ColdFusion. Please verify your typo and try again. Unknown tag: cfajaximport.

When I searched Intermedia's help files I found nothing on Ajax. What I'm wondering now is, maybe this virtual directory script folder is empty...? Do I need to load a javascript library into the cfide/script folder? (I'm shooting in the dark here).

Here's the tag I set up (although I'm not sure just where to place it or if jquery or something needs to be placed in the virtual directory somehow).

<cfajaximport scriptsrc="/myServernumber/CFIDE/scripts" tags="cfform">

- ed

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
Explorer ,
Feb 25, 2011 Feb 25, 2011

Forever thanks, BKBK...

I think we're hitting around the problem now. With this my first cfc and, trying to set it up in a hosted environment, evidently my lack of knowledge of Ajax and virtual script directory is what's throwing all this off. I've searched the help files on the host and googled this issue in hope that this particular post would show the problem solved. (fingers crossed for next post).

My hosted plan does include CF Enterprise Edition -CFMX 8. I understand about the virtual directory CFIDE path now. I set up the cfajaximport scriptsrc as in your previous post, pointing to the script directory and and tried placing this tag on the cfm form page - first trying above the cfform and then within the cfform. I get an error both times: "tag starting with 'CF' has been detected. This tag is not supported by this version of ColdFusion. Please verify your typo and try again. Unknown tag: cfajaximport.

When I searched Intermedia's help files I found nothing on Ajax. What I'm wondering now is, maybe this virtual directory script folder is empty...? Do I need to load a javascript library into the cfide/script folder? (I'm shooting in the dark here).

Here's the tag I set up (although I'm not sure just where to place it or if jquery or something needs to be placed in the virtual directory somehow).

<cfajaximport scriptsrc="/myServernumber/CFIDE/scripts" tags="cfform">

- ed

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
Community Expert ,
Feb 25, 2011 Feb 25, 2011

I see another factor just now, which is critical in any case, namely your mapping

physical directory:
d:\ftp\mywebsite\Htdocs\newWebsite\admin\level2\cfcFolder

logical path:
/getTeachersThisSchool.cfc

In my experience so far, mappings are done to directories, not files. So, I would expect something like this instead

physical directory:
d:\ftp\mywebsite\Htdocs\newWebsite\admin\level2\cfcFolder

logical path:
/myCFCFolder

Here, myCFCFolder is an arbitrary name. Also, I am assuming getTeachersThisSchool.cfc is in cfcFolder. If so, the mapping enables you to reference the CFC as

/myCFCFolder/getTeachersThisSchool.cfc or, using the dotted convention, myCFCFolder.getTeachersThisSchool

This might be enough to solve your problem (that is, even without the cfajaximport malarkey)!

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
Explorer ,
Feb 25, 2011 Feb 25, 2011

BKBK,

Thanks for sticking with me. Judging by the views here -- we have an audience!

I set up mapping per your previous post... Still getting an empty dropdown. I just don't know where to go from here. I hate to do a page refresh to populate the second dropdown -- I had plans to develop several dropdowns on a page using cfc for a user to (more or less) build their own query... I had hoped to get this cfc going so as to gain a knowledge of how this works so I can go on to building more... This sure has been a pain and, I know that you're tired of messing with this as well.

Any suggestions as to what I need to do now? Go to page refresh and forget cfc? Find the latest books on CF and Ajax and Javascripts? I think I'm almost just as confused as when I started this thread...

But! I do thank you for your help and patience all along...

- ed

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
Community Expert ,
Feb 27, 2011 Feb 27, 2011

There is a good reason for us to crack this. It seems the kind of trouble that can befall anyone.

Two questions:

1) Open the path to the script directory in your browser. Can you actually see the following content

FCKeditor/ 
dump/      
ext/       
messages/  
package/   
resources/ 
spry/      
yui/

2) What does this give you:  <cfoutput>#expandpath("/")#</cfoutput>. What I mean is, could you please list the directories.

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
Explorer ,
Mar 01, 2011 Mar 01, 2011

Sorry for the delay. I was away from the computer several days...

And thanks for your perseverance!

I set up a page with the following and get nothing outputted...


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<HTML>
<HEAD>
<TITLE>Untitled</TITLE>
</HEAD>

<BODY>

http://MyServerNumber/CFIDE/

<br><br>

http://MyServerNumber/CFIDE/<cfoutput>#expandpath("/")#</cfoutput>

</BODY>
</HTML>


This is what is outputted:


http://MyServerNumber/CFIDE/

http://MyServerNumber/CFIDE/D:\FTP\MyAccount\Htdocs\


I have a mapping set up to the CFIDE virtual folder, so, with "MyServerNumber" it outputs the same thing no matter where I physically put this test file... It outputs nada...

Maybe I have this test page set up wrong? Or either the virtual folder is empty? (You would think that at least the basic CF tags would be here since this is a Coldfusion hosting server).

- ed

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