[Prototype-core] bracket notation

2007-06-21 Thread sed

I've posted this question to ruby on rails, but figured people here
would be more likely to know the answer.

Using bracket notation in javascript seems to stop workiing when
prototype is included.

e.g. document.main[name].value. Is this a know issue? I know using $
('name').value is the best, but it would seem to be a bug for
prototype to break any existing javascript/dom object access methods.
Thanks.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: bracket notation

2007-06-21 Thread sed

Interesting problem here and I don't think it's a prototype bug, but I
corrected the issue.
Here is what was happening if anyone's interested Here is a short
explanation:

Ajax Call generates some html into a div with this function inside:

GetNextField = function() {return('thenextfield');};

In an included .js file there is another function that goes like so:
function NextField()
{
  FieldName = new String(GetNextField());
  // then doing so breaks
  $(FieldName).focus() or document.main[FieldName].focus();
}

It's the 'new String' that's breaking it, but prior to adding
prototype and dumping all this into a layer with ajax it worked just
fine

The fix:
FieldName = GetNextField();
Bracket and prototype notation both work.

I'm not sure why this worked before, it must be related to the html/
script being generated into the div from the ajax.updater rather than
just being on the page.

Definitely not a prototype problem.

On Jun 21, 12:53 pm, Ryan Johnson [EMAIL PROTECTED] wrote:
 This is very very unlikely. I usebracketnotation with and without
 prototype on many scripts that work cross browser. Check which other
 libraries you are including, and make sure it is not a problem or
 missing attribute of the object you are working with.

 On Jun 21, 8:41 am, sed [EMAIL PROTECTED] wrote:



  I've posted this question to ruby on rails, but figured people here
  would be more likely to know the answer.

  Usingbracketnotation in javascript seems to stop workiing when
  prototype is included.

  e.g. document.main[name].value. Is this a know issue? I know using $
  ('name').value is the best, but it would seem to be a bug for
  prototype to break any existing javascript/dom object access methods.
  Thanks.- Hide quoted text -

 - Show quoted text -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---