# Intercepting form submission

**URL:** <https://www.ruby-forum.com/t/intercepting-form-submission/169020>\
**Category:** Rails\
**Created:** [May 28, 2009, 2:16pm UTC](https://www.ruby-forum.com/t/intercepting-form-submission/169020 "2009-05-28T14:16:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JannaB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/df788c/32.png) [@JannaB](https://www.ruby-forum.com/u/JannaB)\
**Post date:** [May 28, 2009, 2:16pm UTC](https://www.ruby-forum.com/t/intercepting-form-submission/169020/1 "2009-05-28T14:16:42Z")

</div>

Where (what function name must I insert in my controller, I assume)  
can I obtain the selected value from a field in a form, to process and  
change it before it gets written to the model’s table in the db?  
Thanks, Janna B.

---

<div class="post-metadata">

**Author:** ![JannaB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/df788c/32.png) [@JannaB](https://www.ruby-forum.com/u/JannaB)\
**Post date:** [May 28, 2009, 2:55pm UTC](https://www.ruby-forum.com/t/intercepting-form-submission/169020/2 "2009-05-28T14:55:46Z")

</div>

Well, you _could_ choose the ugly path and just place that code in the  
controller create and/or update methods, after your model is  
reconstituted from the params.

Or choose a better path and place that code in a method in the model,  
and define a before\_save in the model that invokes the method  
(before\_save is called for either create or update).
