There is no inherit flaws in Prototype that would cause erratic
behavior like you are describing. That's just plain ludicrous for
somebody to suggest that, typical jQuery crowd trying to pimp their
framework at any chance they can ;)

Right away I think your initializer code is buggy. Not sure why you're
iterating over the entire forms collection and then using a regex to
match an ID. Your form has an ID so why not use it? Or if you will
have multiple forms to observe why not just give them all a class name
then you can match just those forms by doing:

<form method="..." action="..." class="poll">
...
</form>

$$("form.poll").each(...)

Also, you should use a true event observer rather than the onsubmit
attribute, such as:

someFormElement.observe('submit', function(event){ event.stop(); /*
stop the form from being submitted */ });

Also, you are assigning a function to onsubmit, but that function is
lacking the proper scope. I don't see how the code you have would work
in any browser but I guess I'm missing something since you say it
works in IE.

Why don't you try something more like this:

var PollForm = {
  initialize: function(){
    // for each element that matches this selector, invoke the
    // observe method with these arguments
    $$('form.poll').invoke('observe', 'submit',
this.formSubmit.bindAsEventListener(this));
  },
  formSubmit: function(event){
    // stop the form from being submitted
    event.stop();
    // process the form passing in the form relating to the event
    this.processForm(event.element());
  },
  processForm: function(form){
    // do whatever you need to do here
    var formData = form.serialize();
  }
}

document.observe('dom:loaded', PollForm.initialize.bind(PollForm));

See these pages for more info on the various methods used in this example:
http://www.prototypejs.org/api/document/observe
http://www.prototypejs.org/api/utility/dollar-dollar
http://www.prototypejs.org/api/enumerable/invoke
http://www.prototypejs.org/api/event/observe
http://www.prototypejs.org/api/form/serialize

Hope this helps.

-justin

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to