I need to learn how to achieve to dynamically copy form field values 
using Prototype or possibly Ruby.

I want to achieve something like this:

Sorry for posting a jQuery example.
I'm fairly new to Prototype, Scriptaculous and RJS. My goal is to 
achieve similar result using the default libraries of Rails.
Although I am aware of jQuery noConflict() and and all those techniques 
to make jquery work well with other libraries, I just don't want to use 
it for now.

There aren't too many decent examples on how to copy form values for 

My question is:
How do you use that $F function and form.serialize to copy form field 
values to other fields?
Also event observers seem to fail to work if defined on head tag. Am I 

Examples aren't working for me.

So I already have something like this:
<input id="item_weight"  
type="text" value="0" size="10" name="item[weight]"/>

<input id="item__copy_weight"  
type="text" value="0" size="10" name="item[copy_weight]"/>

     <input type="button" id="button3" value="Same as above" />

<script type="text/javascript">
            $('button3').observe('click', function(e) {
                var form = Event.findElement(e, 'form');
                var input = form.down('input[name="item[weight]"]');
What's missing is the code to make the value of item[weight] same as 
[copy_weight] when the button is clicked.
Help would be greatly appreciated.

You received this message because you are subscribed to the Google Groups 
"Prototype &" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to