Keypress events with no AJAX needed

Is anyone else finding it frustrating to do in Ruby client-side things
that would be simple in Javascript?
It seems like all of the “helpers” involve server (controller)
communication.

For example, having a text field that just echos below what the user
types.
Is this the only way to do it?

<%= text_field_tag 'user_text'%> <%= javascript_tag("Event.observe('user_text', 'keypress', function(event) { Element.update('stylized_word', $F(Event.element(event)));})")%>

Thank you!
Chris

Chris, this is just the example. You might want to use that for chat for
example, where text that user types appears not only on his computer,
but for others.

Clearly, if you are doing it for one user there is no point in using
server-side, but again this is just the example
Chris H. wrote:

Is anyone else finding it frustrating to do in Ruby client-side things
that would be simple in Javascript?
It seems like all of the “helpers” involve server (controller)
communication.

For example, having a text field that just echos below what the user
types.
Is this the only way to do it?

<%= text_field_tag 'user_text'%> <%= javascript_tag("Event.observe('user_text', 'keypress', function(event) { Element.update('stylized_word', $F(Event.element(event)));})")%>

Thank you!
Chris

Chris H. wrote:

Is anyone else finding it frustrating to do in Ruby client-side things
that would be simple in Javascript?
It seems like all of the “helpers” involve server (controller)
communication.
The reason for that is extremely simple. Where there’s server
communication, you need a convenient way of keeping the client-side and
server-side code in sync. That’s what the helpers help with. If all
you’re doing is client-side manipulation, you almost certainly don’t
need the helpers. Just use Javascript.

For example, having a text field that just echos below what the user
types.
Is this the only way to do it?
Personally, I wouldn’t bother with the <%= javascript_tag %> call at
all…