[Proto-Scripty] eval Javasvript in response text

2011-04-08 Thread cszalaj
We are using the Ajax.updater. A php script determines the response that is returned to the updater to be passed to the div for updating. In the case that the success message is returned upon successful form submission, we need some javascript to be processed as well. I read in the docs that pure

[Proto-Scripty] Re: eval Javasvript in response text

2011-04-08 Thread T.J. Crowder
Hi, well. I read in the docs that pure javascript returned gets eval'd and processed, but that isn't what I am experiencing. Those same docs[1] say that it's turned off by default. ;-) You need to specify `evalScripts: true` in the options you pass into `Ajax.Updater` to tell it to turn it on.

[Proto-Scripty] Re: eval Javasvript in response text

2011-04-08 Thread T.J. Crowder
If it's not obvious, that example link was to a page that loads another resource via Ajax.Updater. The script is, of course, in that other resource, which is here: http://jsbin.com/ufaji5 -- T.J. :-) On Apr 8, 2:37 pm, T.J. Crowder t...@crowdersoftware.com wrote: Hi, well. I read in the docs

[Proto-Scripty] How would I grab this level of a nested array?

2011-04-08 Thread Walter Lee Davis
If I have a string value like this as the name attribute of a form element: element[312]​[Theme]​ How would I grab the value of that field while ignoring the numerical index, and using the second index value (Theme) to clue in my application about where to place the value? Would this be

[Proto-Scripty] Form Name Reference in IE Broken

2011-04-08 Thread Justin Osborne
I have a test case of something that works in every browser except for IE (testing with IE6-9, but I've seen it work with 9 before) when using Prototype 1.7. We tried upgrading to 1.7 this week and it broke some of our sites because I've used this often in the past with Prototype 1.6 (thus, we had

[Proto-Scripty] Re: How would I grab this level of a nested array?

2011-04-08 Thread T.J. Crowder
Hi, If I'm understanding you correctly, it would be a job for regular expressions: var match = /element\[[0-9]+\]\[([^\]]+)\]/.exec(element.name); if (match) { // Use match[1], which contains Theme } Live example: http://jsbin.com/ozoyi3/2 That allows extra stuff at both the beginning and

[Proto-Scripty] Re: Form Name Reference in IE Broken

2011-04-08 Thread T.J. Crowder
Hi, It fails because you never extend the checkbox element, just the form. On IE, you have to explicitly extend individual elements, Prototype can't do it at the prototype level because IE doesn't allow it. (Prototype extends elements at the prototype level, rather than individually, in just

Re: [Proto-Scripty] Re: How would I grab this level of a nested array?

2011-04-08 Thread Walter Lee Davis
Thanks. I ended up doing this, which may not be as fast as yours: theString.split('][').last().slice(0,-1); Walter On Apr 8, 2011, at 1:28 PM, T.J. Crowder wrote: Hi, If I'm understanding you correctly, it would be a job for regular expressions: var match =

[Proto-Scripty] Re: Form Name Reference in IE Broken

2011-04-08 Thread Justin Osborne
Thanks! I have no idea why earlier versions of Prototype worked with this, yet an upgrade to 1.7 broke it. What you said makes complete sense (in regards to IE anyway). I just wish it broke when I had originally wrote it. :) Regardless, now that I know it's an easy fix we'll be able to upgrade to