First things first right?

So we need to attach a change event handler to the form, unfortunately
in my experiences IE did not play nice with this and did not catch the
bubbling event of an input's change event by observing the form, it
does in FF and that way makes sense but I've had to iterate over all
of the form.elements and attach the listener explicitly.

$A(form.elements).each(function(element){

Event.observe(element, "change", someFunc);

                                   }):


At some point you get into handling the boolean in the event handler
but that is something to handle within your class, good luck you've
almost got it.



On Nov 13, 2:33 am, ditman <[EMAIL PROTECTED]> wrote:
> Well, apparently my version doesn't work in Opera...
>
> I'll try those steps Rob, to see if I can get this working...
>
> On Nov 13, 8:29 am, ditman <[EMAIL PROTECTED]> wrote:
>
> > On Nov 13, 4:13 am, RobG <[EMAIL PROTECTED]> wrote:
>
> > > On Nov 13, 3:30 am, ditman <[EMAIL PROTECTED]> wrote:
>
> > > >, but when I try to exit a page that has
> > > > changed, Event.stop(ev) gets called and a generic IE/Firefox window
> > > > pops up asking something like:
>
> > > I don't see any window at all.
>
> > > --
> > > Rob
>
> > Hi there!
>
> > I've tested that script in IE / Firefox, and it does show a window.
>
> > Try this html:
>
> > <form id="watch_me">
> > <input type="text" id="thing1" name="thing1" value="" /><br />
> > <input type="text" id="thing2" name="thing2" value="" /><br />
> > <input type="text" id="thing3" name="thing3" value="" />
> >  <input type="submit" value=" SUBMIT " />
> > </form>
> > <script type="text/javascript">
> >      new FormWatch('watch_me');
> > </script>
>
> > > What do you mean by "mostly works"?  I can see that the initialize and
> > > confirmExit methods are called, but that's it.  I am not prevented
> > > from leaving a modified page at all.
>
> > If the form has changed, the script calls Event.stop(ev); Which I
> > thought it was enough to "stop" the event from happening... That's the
> > line that pops up a standard window (the same that will pop up if you
> > click here in a link while composing a reply, but instead of saying
> > "Your reply message has not been sent", it says "null" in IE, and
> > nothing at all in Firefox).
>
> > >  I don't see how you determine whether the form has actually changed or 
> > > not.
>
> > new Form.EventObserver(form, this.setChanged.bind(this) );   I think
> > that line does the trick...


--~--~---------~--~----~------------~-------~--~----~
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