You put the trim() as the insert value in your query, not in the form input.
<cfquery name="anon" datasource="#application.dsn#">
INSERT into tableA (col1, col2, part_number)
VALUES (<cfqueryparam value="#trim(form.input1)#" />,<cfqueryparam value="#trim(form.input2)#" />,<cfqueryparam value="#trim(form.Part_Number)#" />)
You can check it on the form submission and the insert into the database.
You can then also trim it when you add it to the database. When you do the insert using coldfusion, just use the trim function then as well.