Hello,
I''m having some trouble observing a text input element with Prototype
1.6. My script works in FireFox but not in IE7. I''m using the XHTML1.0
strict doctype and the HTML validates (so there are no duplicate IDs, etc).
Any ideas why this is not working in IE7? I''m not receiving any JS
errors, and I have JS debugging turned on.
Event.observe(window, ''load'', function(event)
{
if ($$(''form#group'') &&
$(''title'') && $(''url'')) {
alert(''Found required elements'');
alert(''title: '' +
$(''title'').getAttribute(''value'')); // alerts
"title: null" in IE7
var updateGroupUrl = function(event) {
alert(''Event triggered, updating URL...'');
// Replace url field with seo-friendly version of the title
$(''url'').value = Event.findElement(event,
''input'').value.replace(/[^a-zA-Z0-9-]+/g,
''-'').replace(/^\-+/,
'''').replace(/\-+$/, '''').toLowerCase();
};
Event.observe($(''title''), ''click'',
updateGroupUrl);
//Event.observe($(''title''),
''keydown'', updateGroupUrl);
//Event.observe($(''title''), ''keyup'',
updateGroupUrl);
//Event.observe($(''title''),
''change'', updateGroupUrl);
}
}
As you can see, I''ve tried various event types and none of them are
triggered in IE7.
The additional alerts are for testing, and the first alert "Found
required elements" is displayed in IE but that''s as far as it
gets.
Any help would be greatly appreciated. Thanks!
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Hector Virgen wrote:> Hello, > > I''m having some trouble observing a text input element with Prototype > 1.6. My script works in FireFox but not in IE7. I''m using the XHTML1.0 > strict doctype and the HTML validates (so there are no duplicate IDs, > etc). > > Any ideas why this is not working in IE7? I''m not receiving any JS > errors, and I have JS debugging turned on. > > ... alert(''title: '' + $(''title'').getAttribute(''value'')); // > alerts "title: null" ... > > As you can see, I''ve tried various event types and none of them are > triggered in IE7. > > The additional alerts are for testing, and the first alert "Found > required elements" is displayed in IE but that''s as far as it gets. > > Any help would be greatly appreciated. Thanks!"title" may be one of those ids that IE doesn''t like. ("length" was mentioned on the list just recently). Does it happen with another id name? - Ken Snyder --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for the response, Ken.
I tried observing a different text input element, and again it worked in
FF but not in IE7. Tested on input with id "tags".
I''m also concerned as to why
$(''title'').getAttribute(''value'') returns
null, even if the field has a preset value.
Any other suggestions? Thanks again!
-Hector
Ken Snyder wrote:> Hector Virgen wrote:
>
>> Hello,
>>
>> I''m having some trouble observing a text input element with
Prototype
>> 1.6. My script works in FireFox but not in IE7. I''m using the
XHTML1.0
>> strict doctype and the HTML validates (so there are no duplicate IDs,
>> etc).
>>
>> Any ideas why this is not working in IE7? I''m not receiving
any JS
>> errors, and I have JS debugging turned on.
>>
>> ... alert(''title: '' +
$(''title'').getAttribute(''value'')); //
>> alerts "title: null" ...
>>
>> As you can see, I''ve tried various event types and none of
them are
>> triggered in IE7.
>>
>> The additional alerts are for testing, and the first alert "Found
>> required elements" is displayed in IE but that''s as far
as it gets.
>>
>> Any help would be greatly appreciated. Thanks!
>>
> "title" may be one of those ids that IE doesn''t like.
("length" was
> mentioned on the list just recently). Does it happen with another id name?
>
> - Ken Snyder
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
OK, just did another test... and I think you''re right about ''title'' being a reserved name in IE. I updated script by adding a button next to the url field, and when clicked, gets the value from the title, makes it SEO-friendly, and then places it in the url field. The script works if I pull the value from another field (such as "tags") but not from the input with the id of "title". I will choose a different name for this input field. Thanks for the tip! -Hector Ken Snyder wrote:> Hector Virgen wrote: > >> Hello, >> >> I''m having some trouble observing a text input element with Prototype >> 1.6. My script works in FireFox but not in IE7. I''m using the XHTML1.0 >> strict doctype and the HTML validates (so there are no duplicate IDs, >> etc). >> >> Any ideas why this is not working in IE7? I''m not receiving any JS >> errors, and I have JS debugging turned on. >> >> ... alert(''title: '' + $(''title'').getAttribute(''value'')); // >> alerts "title: null" ... >> >> As you can see, I''ve tried various event types and none of them are >> triggered in IE7. >> >> The additional alerts are for testing, and the first alert "Found >> required elements" is displayed in IE but that''s as far as it gets. >> >> Any help would be greatly appreciated. Thanks! >> > "title" may be one of those ids that IE doesn''t like. ("length" was > mentioned on the list just recently). Does it happen with another id name? > > - Ken Snyder > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---