# Re-filling a form with no model

**URL:** <https://www.ruby-forum.com/t/re-filling-a-form-with-no-model/103726>\
**Category:** Rails\
**Created:** [May 9, 2007, 6:26pm UTC](https://www.ruby-forum.com/t/re-filling-a-form-with-no-model/103726 "2007-05-09T18:26:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbeam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/258eb7/32.png) [@sbeam](https://www.ruby-forum.com/u/sbeam)\
**Post date:** [May 9, 2007, 6:26pm UTC](https://www.ruby-forum.com/t/re-filling-a-form-with-no-model/103726/1 "2007-05-09T18:26:57Z")

</div>

Probably a basic question here. I have a search form with a bunch of  
criteria in checkboxes, selects, text fields, etc. When the form is  
submitted I’d like it to be re-displayed with the previous values  
(along with search results if any)

I know how to do this with \<% form\_for @thing %\> and assigning @thing to  
an instance of something in the controller. But since the search terms  
are not tied to a model or any other object, they are just in  
params[:terms] for instance - how do you do it easily?

thanks  
Sam

---

<div class="post-metadata">

**Author:** ![sbeam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/258eb7/32.png) [@sbeam](https://www.ruby-forum.com/u/sbeam)\
**Post date:** [May 9, 2007, 10:02pm UTC](https://www.ruby-forum.com/t/re-filling-a-form-with-no-model/103726/2 "2007-05-09T22:02:05Z")

</div>

Probably not the most elegant solution, but you could just do something  
like this:

\<input name=“mycheckbox” value=“true” type=“checkbox” \<%= “checked”  
unless params[:mycheckbox].nil? %\>\>

Good Luck,

- Eric
