Forum: Ruby on Rails How do I clear values from text_field_tag after browser refresh????

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
20d5957c8a2a95f27212f490a638c401?d=identicon&s=25 fakdora (Guest)
on 2009-02-24 06:29
(Received via mailing list)
Hi all,

I'm having an issue with text_field_tag. I want to reset the value of
the text_field when I refresh my browser, seems like a very simple
thing, however I'm having hard time finding the answer.

After I input some values, how do i reset the value to nil or empty??

my code is below
      <%= text_field_tag 'login', @login, :class => "input-text",
            :onblur => "loginFieldOnBlur('login')",
            :onfocus => "loginFieldOnFocus('login')"
      %>

Any help or tip will be greatly appreciated.

I tried removing @login from text tag, setting @login to null or
empty..setting params[:login] to an empty string in my session
controller...but nothing seems to be working..

Thanks in advance!
C42c706fab23da0b6d3cd2cfbb8db27d?d=identicon&s=25 Salil Gaikwad (salil)
on 2009-02-24 09:01
You can try this..

<%= text_field_tag 'login', @login, :class => "input-text", :value=>""
       %>


fakdora wrote:
> Hi all,
>
> I'm having an issue with text_field_tag. I want to reset the value of
> the text_field when I refresh my browser, seems like a very simple
> thing, however I'm having hard time finding the answer.
>
> After I input some values, how do i reset the value to nil or empty??
>
> my code is below
>       <%= text_field_tag 'login', @login, :class => "input-text",
>             :onblur => "loginFieldOnBlur('login')",
>             :onfocus => "loginFieldOnFocus('login')"
>       %>
>
> Any help or tip will be greatly appreciated.
>
> I tried removing @login from text tag, setting @login to null or
> empty..setting params[:login] to an empty string in my session
> controller...but nothing seems to be working..
>
> Thanks in advance!
This topic is locked and can not be replied to.