Hi, I need a solution with answers.
I have five fields that are set to float in the SQL DB. I want the user to be able to enter numbers, commas, decimals, and negative numbers only. If anything else is entered I want an alert message to popup. However none of these invalid characters will be saved to the DB. So I have this in the action page: <cfset total_dart=#ReReplaceNoCase(total_dart,"[$|,|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|!|@|%|^|&|*|(|)|\|/|]","","all")#>
And this is what the user will see for viewing purposes <cfif isDefined('form.total_dart2')><font color="##FF0000"> <strong>Don't Know </strong></font> <cfelseif total_dart is ""> <font color="##FF0000"> <strong>No Response</strong> </font><cfelse>#numberformat(total_dart)#</cfif>
I want to be able to use a cfinput. I also want to know should I use a CF reg expression or JS. Or can I combine both? I would really like to use CF only.
Heres what I have now for one field.
<cfinput type="text" name=recinj validate="float" validateat="onsubmit" message="Please enter numbers only, in Total Recordables" size="15" maxlength="20" value="#recinj#">