Simple Integer passed from form "Not Numeric"?

Discussion in 'Programming' started by fatlip, Oct 31, 2009.

  1. #1
    I am having a bizarre problem with something so simple.

    I have a form that passes a variable called "team_active" with a value of either 0 or 1. This passes to a CFC that refuses to recognize the "form.team_active" as as Numeric.

    Form:
    <cfselect name="team_active">
              <option value="1" selected>Yes</option>
              <option value="0">No</option>
          	  </cfselect>
    
    PHP:
    CFC:
    
    <cffunction access="public" name="addTeam" output="false" returntype="numeric" displayname="Add New Team">
    <cfargument required="true" name="dsn" type="string"/>
    <cfargument required="true" name="team_name" type="string"/>
    <cfargument required="true" name="team_gm1_name" type="string"/>
    <cfargument required="true" name="team_gm1_email" type="string"/>
    <cfargument required="true" name="team_active" type="numeric" />
    PHP:

    SQL:
      <cfquery datasource="#arguments.dsn#">
    		  INSERT INTO teams
    			(team_name, team_gm1_name, team_gm1_email, team_active
    			)
    		 VALUES (
    			<cfqueryparam value="#arguments.team_name#" cfsqltype="CF_SQL_VARCHAR" maxlength="128"/>,
                <cfqueryparam value="#arguments.team_gm1_name#" cfsqltype="CF_SQL_VARCHAR" maxlength="128"/>,
                <cfqueryparam value="#arguments.team_gm1_email#" cfsqltype="CF_SQL_VARCHAR" maxlength="128"/>,
                <cfqueryparam value="#arguments.team_active#" cfsqltype="CF_SQL_INTEGER" />
            
    			)
    		  </cfquery>
    PHP:
    I get this returned on Submit:
     The TEAM_ACTIVE argument passed to the addTeam function is not of type numeric.
    If the component name is specified as a type of this argument, it is possible that either a definition file for the component cannot be found or is not accessible. 
    PHP:
    And when I look at the form variables at the bottom of the page:
    ADD_TEAM=Add Team
    FIELDNAMES=TEAM_NAME,TEAM_GM1_NAME, TEAM_GM1_EMAIL, TEAM_ACTIVE,MM_INSERTRECORD,ADD_TEAM
    MM_INSERTRECORD=add_team
    TEAM_ACTIVE=1
    
    PHP:
    This can't be rocket science! I have just never seen this behavior before.

    I am running CF9 Dev Server on a Windows 7 Ultimate 64bit machine.

    Also, I am using a MySQL 5.1 Database server and the team_active field is INT, length 11, Allow NULL=NO and not ZEROFILLED.


    TIA,
    Greg
     
    fatlip, Oct 31, 2009 IP
  2. fatlip

    fatlip Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Never fails that as soon as you post, you solve your own issue.

    I pass the form variables to a script that was simply missing the team_active variable.... GRRRRRRR
     
    fatlip, Oct 31, 2009 IP