Posted by dalleyasaurus on December 12, 2012 at 12:29pm
I have this definition and I'm trying to use it to retrieve a price formatted as currency. However everytime I submit the form it turns up with rounded down. So if I submit 12.99 it comes out as 12.00
Any ideas??
$form['amount1'] = array(
'#type' => 'textfield',
'#title' => t('Amount (+/-)'),
'#default_value' => '',
'#size' => 10,
'#maxlength' => 128,
'#required' => TRUE,
'#weight' => 3,
'#element_validate' => array('element_validate_number'),
'#suffix' => '<br/><hr><br/>',
);There is no additional validating other than element_validate_number (at this point) and the submit function doesn't change anything either.
Comments
Figured it out
Sorry to bother anyone
It turns out that in the data was fine before it was entered into a custom database table. The .install file set the data table column as integer but I had changed it to decimal in mysql manually but not update the .install file
Make sure if you manually build the tables that you have the same type in your .install file.
I'm David, a PADI Rescue Diver, Web Developer and Pastor. I'm currently building a online service to manage private loans for vendor financing.