# Saving form data with currency symbols / validating custom f

**URL:** <https://www.ruby-forum.com/t/saving-form-data-with-currency-symbols-validating-custom-f/74971>\
**Category:** Rails\
**Created:** [November 7, 2006, 11:04am UTC](https://www.ruby-forum.com/t/saving-form-data-with-currency-symbols-validating-custom-f/74971 "2006-11-07T11:04:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 7, 2006, 11:04am UTC](https://www.ruby-forum.com/t/saving-form-data-with-currency-symbols-validating-custom-f/74971/1 "2006-11-07T11:04:32Z")

</div>

I’m trying to display a numeric attribute of a model as a currency on a  
form, and then save the user’s input. So the text field might display  
‘$9.98’ and the user is allowed to enter dollar signs. How can I  
remove the dollar sign before saving to the db and still display the  
user’s original input string in error messages?

My template file looks like this:

\<%= text\_field(“winning[]”, “amount”,  
:value =\> number\_to\_currency(@winning.amount) %\>

I tried manually removing the dollar signs from the values in the  
params hash before applying them to the models (via update\_attributes)  
but then the models don’t have the user’s original inputs, and I’m  
using the error\_messages\_for tag to display the errors. I was also  
trying to avoid hacking presentation format knowledge into the model  
object if possible.

Any ideas?

Thanks!

Steve
