Can I also assume that you have either wrapped your listener function in a dom:loaded listener, or have placed it inside a script block BELOW the ajzip element?

That's another reason why it might not work in some cases, although I would be surprised if it worked in any browser if the listener was defined in the DOM before the element it was supposed to listen to.

http://jsbin.com/odusi5/3

Walter

On Jun 13, 2011, at 11:35 AM, Phil Petree wrote:

Walter you made me doubt myself... LOL I've been integrating this new code with the old form and the id's are different in the old form but I had made those changes.

Event.observe('ajzip', 'keyup', cities);
<label class='column' id='labzip' for='ajzip'>5 Digit Zip:</ label><input type='text' name='zip' size='5' maxlength='5' id='ajzip' class='required validate-digits'>


On Mon, Jun 13, 2011 at 11:12 AM, Walter Davis <wa...@wdstudio.com> wrote: Does your field have the ID attribute set to 'zip'? If it's working in IE, that's a strong bet that it doesn't, but that it does have the name set to 'zip'. Element.getValue() and $F() need a valid (properly-formed and unique on the page) ID for their magic to happen. If you can't add an ID to the input, you can pass a more elaborate selector like document.forms[0].zip (without surrounding quotes, naturally) into the function. $() will work from an object or an ID, but it won't work with just a name, except in IE, which has a serious bug in that corner.

Walter


On Jun 13, 2011, at 11:03 AM, Phil Petree wrote:

In Firefox 3.6.16

I have an Event.observe('ajzip', 'keyup', cities); and the first line of which tests to see if I have 5 digits entered in the zip code field and if so it makes an ajax call... works great in IE. When I press and release a key, my function "cities" gets called, it tests the length of zip and then jumps into prototype.js on line 4064 where it attempts to execute the following lines:

 1) getValue: function(element) {
 2)  element = $(element);
 3)  var method = element.tagName.toLowerCase();
 4) return Form.Element.Serializers[method](element);
When line 1 gets called, element is set to "zip"; line 2 returns null and line 3 throws an "Element is null" error!

Like I said, this all works fine in IE.  Any ideas?

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

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



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

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