Hi,

...although despite the API docs saying *nothing* about it,
Form.EventObserver looks like it might do what you want on an event
(rather than timed) basis. Note that that may not necessarily do what
you want because it uses the `change` event on `select` and `text`
boxes, which is only fired by some browsers when the select/text box
loses focus (not on keypress). The timed check done by Form.Observer
happens more proactively (but -- especially on IE -- can be a drain on
the CPU).

But I would expect this (your quoted code with a </script> tag removed
from the middle of it) to *basically* work:

new Form.EventObserver($("myform"), updateFormMessage);
function updateFormMessage() {
  $('myform_msg').innerHTML = "Click the Save button to save your new
settings.";
  alert("Form Changed!");
}

...and in fact:
http://jsbin.com/aboxu4

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com


On Aug 23, 7:37 am, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
> Hi,
>
> You want Form.Observer, not Form.EventObserver, and you need to
> provide an interval telling it how often to check the form for
> changes. It happens that your use case *is* the example used on
> Form.Observer:http://api.prototypejs.org/dom/form/observer/
>
> HTH,
> --
> T.J. Crowder
> Independent Software Consultant
> tj / crowder software / comwww.crowdersoftware.com
>
> On Aug 23, 12:36 am, Phil Petree <phil.pet...@gmail.com> wrote:
>
>
>
> > Hey All!
>
> > I'm trying to implement a Form.EventObserver that will change a message
> > within the form.  By default the message says: "These are your current
> > settings." and when a key is pressed I want the message to get changed to
> > say "Click the Save button to save your new settings."
>
> > I have the function that sets the form message and its working just fine
> > (gets called from other routines like during an ajax onComplete).
>
> > My problem is that I can not get the Form.EventObserver to call my routine.
>
> > I have tried putting this in the form header, in a .js file that gets
> > included specifically for this form and inline just below the form (which is
> > what most examples show) and nadda... zip... zilch... nothing!  No errors
> > and it absolutely doesn't get called!
>
> > // this code was used in the header and inline, strip off the <script> tags
> > and the
> > // raw javascript code was tried in the included form_name.js file
> > <script type="text/javascript">
> > new Form.EventObserver($("myform"), updateFormMessage);
> > </script>
> > function updateFormMessage() {
> >   $('myform_msg').innerHTML = "Click the Save button to save your new
> > settings.";
> >   alert("Form Changed!");
>
> > }
>
> > Any suggestions would be appreciated!
>
> > Thanks,
>
> > Pete

-- 
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-scriptacul...@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