Question

I have about 1 day of learning, until I need to be able to use Coldfusion (any detailed tutorial would be welcome).

I have 2 files (t1.cfm and progress.cfc) in ColdFusion10\cfusion\wwwroot

t1.cfm:

<CFIF IsDefined("session.STATUS")>
<cfset StructDelete(Session, "Status") />
</CFIF>

<html>
<head>
    <title>progressbar</title>
    <script type="text/javascript">
        function startprogress(barname){
            ColdFusion.ProgressBar.show(barname);
            ColdFusion.ProgressBar.start(barname);
        }
        function onFin(){
            alert('Done');
        }
    </script>
</head>
<body>
    <cfform>
    <p>
        <cfinput type="button" name="starter" value="start" onclick="startprogress('du')" />
        <cfprogressbar name="du" duration="10000" interval="1000" width="200" oncomplete="onFin" />
    </p>
    <p>
        <cfinput type="button" name="starter1" value="start" onclick="startprogress('du1')" />
        <cfprogressbar name="du1" bind="cfc:progress.getstatus()" interval="1000" width="200" oncomplete="onFin" />
    </p>
    </cfform>
</body> 
</html>

progress.cfc:

component output="false"
{
    remote funktion getStatus(){
        str = StructNew();
        str.message = "blabla";
        if(NOT IsDefined("session.STATUS")){
            session.STATUS = 0.1;
            Sleep(200);
        }else if(session.STATUS LT 0.9){
            session.STATUS =session.STATUS +.1;
            Sleep(200);
        }else{
            str.message= "Done...";
            session.STATUS=1.0;
        }
        str.status =session.STATUS;
        return str;
    }
}

When I open t1.cfm it says:

The specified CFC progress could not be found. The path to the CFC must be specified as a full path, or as a relative path from the current template, without the use of mappings.

I guess the problem is with bind="cfc:progress.getstatus()" but the tutorial I followed did the exact same thing and it worked there. What did I do wrong?

Was it helpful?

Solution

Think you've got a typo:

 remote funktion getStatus(){

should be:

 remote function getStatus(){

you put a K in function, rather than the C it'd need.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top