# Sticky Forms

**URL:** <https://www.ruby-forum.com/t/sticky-forms/109949>\
**Category:** Rails\
**Created:** [July 20, 2007, 4:37pm UTC](https://www.ruby-forum.com/t/sticky-forms/109949 "2007-07-20T16:37:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [July 20, 2007, 4:37pm UTC](https://www.ruby-forum.com/t/sticky-forms/109949/1 "2007-07-20T16:37:25Z")

</div>

Hi all,

I am trying to create a log-in page where the person logs in and based  
on where or not they entered the correct format for a password and email  
address, they may proceed to the next page. If, however, the check  
fails, they get kicked back to the log-in page. What I would like is to  
have the info (excluding their password and emailaddress which is what  
would make the log-in fail), be re-displayed in the form when they get  
kicked back. I have tried:

redirect\_to :action =\> ‘traveler\_form’, :id =\> params

in my controller which I was hoping would just kick back the params  
hash, but it doesn’t work. Any ideas, thanks in advance, and thank God  
it’s Friday!

~S

---

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [July 20, 2007, 5:40pm UTC](https://www.ruby-forum.com/t/sticky-forms/109949/2 "2007-07-20T17:40:18Z")

</div>

\<dirty\_mode\>  
before you redirect set a variable @login = params[:user\_name] for  
example  
in your view you put as option in your text\_field ‘:value =\> @login’  
\</dirty\_mode\>

There is probably a better solution than this 🙂

Stijn

---

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [July 20, 2007, 6:13pm UTC](https://www.ruby-forum.com/t/sticky-forms/109949/3 "2007-07-20T18:13:06Z")

</div>

Stijn P. wrote:

> \<dirty\_mode\>  
> before you redirect set a variable @login = params[:user\_name] for  
> example  
> in your view you put as option in your text\_field ‘:value =\> @login’  
> \</dirty\_mode\>
> 
> There is probably a better solution than this 🙂
> 
> Stijn

It doesn’t take the value option. If I say:

\<%= text\_field ‘user’, ‘company’, :value =\> @login %\>

it never shows the value attribute in the raw html. Is :value one of the  
ptions that you can pass to the text\_field helper?

---

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [July 20, 2007, 6:42pm UTC](https://www.ruby-forum.com/t/sticky-forms/109949/4 "2007-07-20T18:42:36Z")

</div>

Shandy N. wrote:

> Stijn P. wrote:
> 
> > \<dirty\_mode\>  
> > before you redirect set a variable @login = params[:user\_name] for  
> > example  
> > in your view you put as option in your text\_field ‘:value =\> @login’  
> > \</dirty\_mode\>
> > 
> > There is probably a better solution than this 🙂
> > 
> > Stijn
> 
> It doesn’t take the value option. If I say:
> 
> \<%= text\_field ‘user’, ‘company’, :value =\> @login %\>
> 
> it never shows the value attribute in the raw html. Is :value one of the  
> ptions that you can pass to the text\_field helper?

Yes it does.  
problem is maybe that in your ‘traveler\_form’ action, you 'll override  
this value.  
Are you doing maybe @user = User.new there ?  
That’s one of the reasons why it would be better not to do a redirect,  
but only a :render.

Stijn
