Greetings.
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:
http://websitebuildersresource.com/2009/02/05/copy-form-input-data-to-another-input-field-with-jquery/

http://websitebuildersresource.com/demos/jquery-copy-form-data/

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 
prototype.

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 
right?

http://www.prototypejs.org/api/event/observe

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]"]');
 
                alert($F(input));
            });
        </script>
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 & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to