How do I clear values from text_field_tag after browser refresh?


#1

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!


#2

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!