I have a form for internal users, they submit information for some 
certifications. I have a bug, where they can hit the submit button a few times 
and it'll insert that row as duplicates 2-3 times depending on clicks. Is there 
a way to prevent this? 

    <!--- Modify a user method --->
    <cffunction name="addEmployee" returntype="boolean">
      
    <!--- Certifications --->
        
        <!--- CPR Certifications --->    
        <cfargument name="cprAdultExp" required="NO">
        <cfargument name="cprAdultCompany" type="string" required="no">
        <cfargument name="cprAdultFile" type="string" required="no">     
       
        <cfargument name="cprChildExp" required="NO">
        <cfargument name="cprChildCompany" type="string" required="no">
        <cfargument name="cprChildFile" type="string" required="no">  
        
        <cfargument name="cprInfantExp" required="NO">
        <cfargument name="cprInfantCompany" type="string" required="no">
        <cfargument name="cprInfantFile" type="string" required="no">  
        
        <cfargument name="cprFPRExp" required="NO">
        <cfargument name="cprFPRCompany" type="string" required="no">
        <cfargument name="cprFPRFile" type="string" required="no">  
        
        <!--- Other Certifications --->
        <cfargument name="aedEXP" required="NO">
        <cfargument name="aedCompany" type="string" required="no">
        <cfargument name="aedFile" type="string" required="no">
        
        <cfargument name="firstAidExp" required="NO">
        <cfargument name="firstAidCompany" type="string" required="no">
        <cfargument name="firstAidFile" type="string" required="no">
        
        <cfargument name="emtExp" required="NO">
        <cfargument name="emtCompany" type="string" required="no">
        <cfargument name="emtFile" type="string" required="no">
        
        <cfargument name="waterSafetyInstructionExp" required="NO">
        <cfargument name="waterSafetyInstructionCompany" type="string" 
required="no">
        <cfargument name="waterSafetyInstructionFile" type="string" 
required="no">
        
        <cfargument name="bloodPathogensExp" required="NO">
        <cfargument name="bloodPathogensCompany" type="string" required="no">
        <cfargument name="bloodPathogensFile" type="string" required="no">
        
        <cfargument name="oxygenAdminExp" required="NO">
        <cfargument name="oxygenAdminCompany" type="string" required="no">
        <cfargument name="oxygenAdminFile" type="string" required="no">
        
        <cfargument name="lifegaurdingExp" required="NO">
        <cfargument name="lifegaurdingCompany" type="string" required="no">
        <cfargument name="lifegaurdingFile" type="string" required="no">
        
        <cfargument name="certNotes" type="string" required="no">
        
    
        <!--- Adding a new Employee ---> 
        <cfquery datasource="#DSN#">

         <!--- Inserts the certification related to the student ID --->  
         INSERT INTO 
            mod_StudentCertifications(
                    profileID,
                    
                    cprAdultExp,
                    cprAdultcompany,
                    cprAdultImage,
                    cprAdultOnFile,
                    
                    cprInfantChildExp,
                    cprInfantChildcompany,
                    cprInfantChildImage,
                    cprInfantChildOnFile,
                    
                    cprFPRExp,
                    cprFPRcompany,
                    cprFPRImage,
                    cprFPROnFile,
                    
                    aedExp,
                    aedcompany,
                    aedImage,
                    aedOnFile,
                    
                    firstAidExp,
                    firstAidcompany,
                    firstAidImage,
                    firstAidOnFile,
                    
                    emtExp,
                    emtcompany,
                    emtImage,
                    emtOnFile,
                    
                    waterSafetyInstructionExp,
                    waterSafetyInstructioncompany,
                    waterSafetyInstructionImage,
                    waterSafetyInstructionOnFile,
                    
                    bloodPathogensExp,
                    bloodPathogenscompany,
                    bloodPathogensImage,
                    bloodPathogensOnFile,
                    
                    oxygenAdminExp,
                    oxygenAdmincompany,
                    oxygenAdminImage,
                    oxygenAdminOnFile,
                    
                    lifegaurdingExp,
                    lifegaurdingcompany,
                    lifegaurdingImage,
                    lifegaurdingOnFile,
                    
                    wildernessResponderExp,
                    wildernessResponderCompany,
                    wildernessResponderImage,
                    wildernessResponderOnFile, 
                    
                    certNotes,
                    isActive,
                    certClassRegistered
            )
            
            <!--- This is the method that takes the form data and inputs it --->
            VALUES(
                '#Trim(ARGUMENTS.profileID)#',
                
                '#DateFormat(ARGUMENTS.cprAdultExp, "mm/dd/yyyy")#',
                '#Trim(ARGUMENTS.cprAdultCompany)#',
                '#Trim(ARGUMENTS.cprAdultImage)#',
                '#Trim(ARGUMENTS.cprAdultOnFile)#',
                
                '#DateFormat(ARGUMENTS.cprInfantChildExp, "mm/dd/yyyy")#',
                '#Trim(ARGUMENTS.cprInfantChildcompany)#',
                '#Trim(ARGUMENTS.cprInfantChildImage)#',
                '#Trim(ARGUMENTS.cprInfantChildOnFile)#',
                
                '#DateFormat(ARGUMENTS.aedEXP, "mm/dd/yyyy")#',
                '#Trim(ARGUMENTS.aedCompany)#',
                '#Trim(ARGUMENTS.aedImage)#',
                '#Trim(ARGUMENTS.aedOnFile)#',
                
                '#DateFormat(ARGUMENTS.cprFPRExp, "mm/dd/yyyy")#',
                '#Trim(ARGUMENTS.cprFPRCompany)#',
                '#Trim(ARGUMENTS.cprFPRImage)#',
                '#Trim(ARGUMENTS.aedImage)#',
                
                '#DateFormat(ARGUMENTS.firstAidExp, "mm/dd/yyyy")#',
                '#Trim(ARGUMENTS.firstAidCompany)#',
                '#Trim(ARGUMENTS.firstAidImage)#',
                '#Trim(ARGUMENTS.firstAidOnFile)#',
                
                '#DateFormat(ARGUMENTS.emtExp, "mm/dd/yyyy")#',
                '#Trim(ARGUMENTS.emtCompany)#',
                '#Trim(ARGUMENTS.emtImage)#',
                '#Trim(ARGUMENTS.emtOnFile)#',
                
                '#DateFormat(ARGUMENTS.waterSafetyInstructionExp, 
"mm/dd/yyyy")#',
                '#Trim(ARGUMENTS.waterSafetyInstructionCompany)#',
                '#Trim(ARGUMENTS.waterSafetyInstructionImage)#',
                '#Trim(ARGUMENTS.waterSafetyInstructionOnFile)#',
                
                '#DateFormat(ARGUMENTS.bloodPathogensExp, "mm/dd/yyyy")#',
                '#Trim(ARGUMENTS.bloodPathogensCompany)#',
                '#Trim(ARGUMENTS.bloodPathogensImage)#',
                '#Trim(ARGUMENTS.bloodPathogensOnFile)#',
                
                '#DateFormat(ARGUMENTS.oxygenAdminExp, "mm/dd/yyyy")#',
                '#Trim(ARGUMENTS.oxygenAdminCompany)#',
                '#Trim(ARGUMENTS.oxygenAdminImage)#',
                '#Trim(ARGUMENTS.oxygenAdminOnFile)#',
                
                '#DateFormat(ARGUMENTS.lifegaurdingExp, "mm/dd/yyyy")#',
                '#Trim(ARGUMENTS.lifegaurdingCompany)#',
                '#Trim(ARGUMENTS.lifegaurdingImage)#',
                '#Trim(ARGUMENTS.lifegaurdingOnFile)#',
                
                '#DateFormat(ARGUMENTS.wildernessResponderExp, "mm/dd/yyyy")#',
                '#Trim(ARGUMENTS.wildernessResponderCompany)#',
                '#Trim(ARGUMENTS.wildernessResponderImage)#',
                '#Trim(ARGUMENTS.wildernessResponderOnFile)#',
                
                '#Trim(ARGUMENTS.certNotes)#',
                'True',
                'False'
            )
              
       </cfquery>
    
       <!--- Returns true for the coldfusion componet --->
        <cfreturn true>
       
    </cffunction> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343972
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to