How to call javascript function in text_field_tag

Dear all

Sorry for dummy question. How can I convert a text input in form to
upper case letter in view?

Can I call the javascript function toUpperCase() in text_field_tag??
<%= text_field_tag(:sometext, nil, :size => 14) %>

I know I can achieve this using params[:sometext].upcase in controller,
but I want to do this in view. Any ideas?

Many thanks
Valentino

<%= text_field_tag(:sometext, nil, :size => 14 , :onchange =>
“changecase();”) %>

When u enter the text in the textbox and when the focus goes out of the
textbox the text changes to uppercase.

Hope this might help.

Hi Charanya,

Or try using unobtrusive JavaScript by giving the field a unique id and
then hooking up the action to that id. With jQuery it is very simple.

To get the field just use:

$(’#uniqueid’)

and then you can chain any function to the element.

HTH,
Schalk