Your DOM element form#scripty doesn't exist yet when you observe it.

You must do either of the following:

<script type="text/javascript" src="http://www.website.com/prototype/
prototype.js"></script>
<script type="text/javascript">
function bindFormToAJAX() {
  Event.observe('scripty', 'submit', function(e) {
    Event.stop(e);
    $('scripty').request({
      onComplete: function(transport) {
        $('script').value = transport.responseText;
      }
    });
  });

}

</script>
<body>
<form id="scripty" action="test2.php">
<textarea id="script" name="script">aaaa
</textarea><input type="submit" value="Send it!"/>
</form>
<script type="text/javascript">
  bindFormToAJAX() <----------- HERE!!!!!!!!!!!!!!!!!!!
</script>
</body>
</html>

or:

<script type="text/javascript" src="http://www.website.com/prototype/
prototype.js"></script>
<script type="text/javascript">
function bindFormToAJAX() {
  Event.observe('scripty', 'submit', function(e) {
    Event.stop(e);
    $('scripty').request({
      onComplete: function(transport) {
        $('script').value = transport.responseText;
      }
    });
  });

}
Event.observe(window, 'load', bindFormToAJAX); <------
HERE !!!!!!!!!!!!!!!
</script>
<body>
<form id="scripty" action="test2.php">
<textarea id="script" name="script">aaaa
</textarea><input type="submit" value="Send it!"/>
</form>
</body>
</html>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to