Sticky Forms

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

<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 :slight_smile:

Stijn

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 :slight_smile:

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?

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 :slight_smile:

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