Johnny McGahee
Johnny McGahee

Reputation: 11

flash form error - no method with the name 'submit'

I am new to ColdFusion and I am struggling to figure out how to do some simple functions that I could do in MS Access easily.

I keep getting an error: no method with the name 'submit'. This error only occurs because of the form format is flash.

Any help would be greatly appreciated.

    <html>
<cfparam name="form.state" default="">
<cfparam name="form.lastname" default="">

<!---Grid Source---> 
<cfquery name="getArtists" datasource="cfartgallery">
    SELECT A.*
    FROM ARTISTS A
    WHERE
        1=1
    AND STATE like <cfqueryparam value="%#form.state#%" cfsqltype="CF_SQL_VARCHAR" maxlength="255">
    AND LASTNAME like <cfqueryparam value="%#form.lastname#%" cfsqltype="CF_SQL_VARCHAR" maxlength="255">
    ORDER BY A.LASTNAME, A.FIRSTNAME
</cfquery>


<head>
</head>
<body style="padding:20px;">

<cfform action="TEST.cfm" method="post" format="flash">


<cfformgroup type="horizontal" style="backgroundAlpha:0;font-size:12;color:##000;">
    <cfformgroup type="vertical" width="100">

<!---Query for STATE--->
<cfquery name="getState" datasource="cfartgallery">
    SELECT A.STATE   
    FROM ARTISTS A
    WHERE
        1=1
        AND LASTNAME like <cfqueryparam value="%#form.lastname#%" cfsqltype="CF_SQL_VARCHAR" maxlength="255">
</cfquery>

<!---STATE Dropdown---> 
<cfselect name="state" query="getState" queryposition="below" 
    label="State:"
    value="STATE"
    display="STATE"  
    required="no"
    selected="#form.state#"
    onchange="submit();"
    style="backgroundAlpha:0;" width="125">
    <option></option>
</cfselect>


    </cfformgroup>
    <cfformgroup type="vertical" width="100">

<!---Query for LastName--->
<cfquery name="getLast" datasource="cfartgallery">
    SELECT A.LASTNAME   
    FROM ARTISTS A
    WHERE
        1=1
        AND STATE like <cfqueryparam value="%#form.state#%" cfsqltype="CF_SQL_VARCHAR" maxlength="255">
</cfquery>

<!---LastName Dropdown---> 
<cfselect name="lastname" query="getLast" queryposition="below" 
    label="Last Name:"  value="LASTNAME" display="LASTNAME"  
    selected="#form.lastname#"
    required="no" 
    onchange="submit();"
    style="backgroundAlpha:0;" width="125">
    <option></option>
</cfselect>

    <a href="TEST.cfm"><input type="button" value="Reset"></a>
    </cfformgroup>
    </cfformgroup>

     <cfformitem type="spacer" height="20"/>


<!---Grid---> 
        <cfgrid name="myGrid" query="getArtists" format="html">
            <cfgridcolumn name="ARTISTID" header="ARTISTID" width="75" headeralign="center" dataalign="center"/>
            <cfgridcolumn name="FIRSTNAME" header="FIRSTNAME" width="100" headeralign="center" dataalign="center"/>
            <cfgridcolumn name="LASTNAME" header="LASTNAME" width="75" headeralign="center" dataalign="center"/>
            <cfgridcolumn name="ADDRESS" header="ADDRESS" width="100" headeralign="center" dataalign="center"/>
            <cfgridcolumn name="CITY" header="CITY" width="125" headeralign="center" dataalign="center"/>
            <cfgridcolumn name="STATE" header="STATE" width="125" headeralign="center" dataalign="center"/>
            <cfgridcolumn name="POSTALCODE" header="POSTALCODE" headeralign="center" dataalign="center"/>
            <cfgridcolumn name="EMAIL" header="EMAIL" width="125" headeralign="center" dataalign="center"/>
            <cfgridcolumn name="PHONE" header="PHONE" headeralign="center" dataalign="center"/>
            <cfgridcolumn name="FAX" header="FAX" headeralign="center" dataalign="center"/>
            <cfgridcolumn name="THEPASSWORD" header="THEPASSWORD" headeralign="center" dataalign="center"/>
         </cfgrid>

    </cfform>

</body>
</html>

Upvotes: 0

Views: 221

Answers (3)

James A Mohler
James A Mohler

Reputation: 11120

in this context does not generate an HTML form. Hence you can't use JavaScript/DOM

Note: everything inside of <cfsavecontent> is ActionScript:

<cfsavecontent variable="astest">
if(_global.arrMembers == undefined) _global.arrMembers = data.dataProvider.slice(0);
    var arrMembers = _global.arrMembers;
var arrDisplay:Array = [];

for(var i = 0; i < arrMembers.length; i++)
 {
    if(arrMembers[i].dept == myselect1.value || myselect1.value == 'All')
    {
        arrDisplay.push(arrMembers[i]);
    }
}
    data.dataProvider = arrDisplay;

</cfsavecontent>

Then later:

<cfselect ... onChange="#astest#">

Reference: http://www.asfusion.com/examples/item/filtering-records-on-a-cfform-grid

Upvotes: 1

Miguel-F
Miguel-F

Reputation: 13548

Dan brings up a good point, my original answer was based on an HTML form, not a Flash form. So that original answer is not valid. However, I did find that the Flash forms in ColdFusion use ActionScript, not JavaScript. See the reference here Using ActionScript in Flash forms. That page also mentions that the custom ActionScript functions available for all form controls to reset or submit a form are resetForm() and submitForm(). So try changing your onchange event from submit(); to submitForm() like this:

    onchange="submitForm()"

I don't know if the semi-colon is needed or not for ActionScript.


* --- ORIGINAL ANSWER BELOW FOR HISTORICAL PURPOSES --- *

You did not say when you are getting the error "no method with the name 'submit'.". Looking at the code that you supplied I am assuming you get the error when you select something from either the state or last name drop-down box of your form. Are you trying to submit the form when either of these selections change? If my assumptions are correct then you might try giving your form an id and then qualifying your submit statement. Something like this:

Give your form an id

<cfform id="yourformid" action="TEST.cfm" method="post" format="flash">

Qualify your submit statements

<cfselect ...
    onchange="document.getElementById("yourformid").submit();"

Upvotes: 1

Dan Bracuk
Dan Bracuk

Reputation: 20794

This,

onchange="submit();"

would be

onchange="this.form.submit();"

if you had an html form. I'm not sure about flash forms.

Upvotes: 0

Related Questions