I have a variety of number fields in a form. A few of the numbers should be integers, but a few should be decimals, too.
When a decimal number, like a GPA, is entered, only the integer portion appears in the custom display. While the entire number is stored, the decimal point and everything to the right is truncated in the custom display. So, 3.75 is stored but only 3 appears.
I suspect that it might have to do with this bit of code that I added to my theme's functions.php file per your instructions in http://formidablepro.com/help-desk/publishing-all-form-data-to-a-post/#frm_topic_9950
add_action('frm_field_input_html', 'add_min_max');
function add_min_max($field){
if($field['type'] == 'number')
echo ' min="0" max="9999"';
}
In a later post in that exchange, you mention setting steps separately for different fields. This is only my hunch, but it seems that the default step is “1″ and that default step also determines the truncation; so, nothing more precise than the default step will appear. If that is the issue, is there a way to correct it?
Also, when zero is entered as a valid value, nothing appears in the custom display. For example, if someone enters their height as “6″ in the feet field and “0″ in the inches field, we would like it to appear as 6' 0'', but it appears as 6' ''. (I'm using bold so that I don't have too many quotes or hash marks.)
As always, thanks for your help on your excellent app.





December 16, 2010 at 6:12 am
Have you updated to the lastest version? If so, you can remove that code now and use the settings in the "field options" for the number fields.
However, that is a separate issue then the 3 displaying instead of 3.75. It looks like I set the number field to set the value to an integer when the entry is submitted. This won't fix previous submissions, but please make this change to allow floating decimals. This will be included in the next release. Please open formidable/pro/classes/models/FrmProEntryMeta.php and change line 18 from:
$values['meta_value'] = (int)$values['meta_value'];
to:
$values['meta_value'] = (float)$values['meta_value'];
June 25, 2011 at 7:01 pm
I am also having trouble using a numeric field for a float value such as interest rate. I need to be able to accept 2 decimal places like 5.25 or 6.55.
The problem only occurs when using the CHROME browser. Then only INTEGERS are allowed. This seems to be caused by the clause:
Also it would be great if it would work by step="0.25" but I don't think the HTML command works that way.
I also tried "blanking" out the min max and step values in FORMIDABLE, but these values still persist in the published form source code (causing this problem with float in CHROME).
Does NOT have this problem in browsers: IE, Safari, and Firefox.
June 27, 2011 at 10:59 am
You need to change the step in the field options to 0.01. That should work just fine.
Topic closed.