[Proto-Scripty] Prototype and IE
Hello, i am using ajax from prototype and some effects with scriptaculous and i am getting a strange behaviour when it is to be executed in Internet Explorer, my code use prototype history manager and for some reason my contents isn't show in IE, the core of the javascript is listed below: var site = null; var Chiquinho = Class.create(); Chiquinho.prototype = { initialize : function(links) { this.justloaded = true; this.currentLink = undefined; this.links = links; this.contentEl = $('ajax-content'); this.site_urls = { home : '/', empresa : '/empresa', artista : '/artista', agenda : '/agenda', locacao : '/locacao', contrate : '/contrate', depoimento : '/depoimento', parceiro : '/parceiro', contato : '/contato', artista1 : '/artista/show/id/1', artista2 : '/artista/show/id/2', artista3 : '/artista/show/id/3', artista4 : '/artista/show/id/4', artista5 : '/artista/show/id/5', artista6 : '/artista/show/id/6', artista7 : '/artista/show/id/7', artista8 : '/artista/show/id/8', artista9 : '/artista/show/id/9', artista10 : '/artista/show/id/10', artista11 : '/artista/show/id/11', artista12 : '/artista/show/id/12', artista13 : '/artista/show/id/13', artista14 : '/artista/show/id/14', artista15 : '/artista/show/id/15', artista16 : '/artista/show/id/16', artista17 : '/artista/show/id/17', artista18 : '/artista/show/id/18', artista19 : '/artista/show/id/19' }; this.protoHistoryManager = new ProtoHistoryManager(); this.reqHistory = this.protoHistoryManager.register('pages', [ this.links[0] ], // default, page 0 function(values) { var index = this.links.indexOf(values[0]); if (index == 0 this.justloaded) { return; } if (index != -1) { this.justloaded = false; this.linkClick(this.site_urls[values[0]], values[0]); } }.bind(this)); this.protoHistoryManager.start(); }, linkClick : function(url, linkid) { this.currentLink = { url : url, linkid : linkid }; this.cleanContent(); this.reqHistory.setValue(0, linkid); }, cleanContent : function() { new Effect.Appear(this.contentEl, { from : 1.0, to : 0.0, duration : 1.0, afterFinish : this.getPage.bind(this) }); }, getPage : function() { if (this.currentLink != undefined) { var url = this.currentLink.url; new Ajax.Updater('ajax-content', url, { onSuccess : function() { new Effect.Appear(this.contentEl, { from : 0.0, to : 1.0, duration : 1.0 }); }.bind(this) }); } } }; Event.onDOMReady(function() { site = new Chiquinho( [ 'home', 'empresa', 'artista', 'agenda', 'locacao', 'contrate', 'depoimento', 'parceiro', 'contato', 'artista1', 'artista2', 'artista3', 'artista4', 'artista5', 'artista6', 'artista7', 'artista8', 'artista9', 'artista10', 'artista11', 'artista12',
Re: [Proto-Scripty] Re: Ajax and json
Le lundi 21 décembre 2009 13:05, T.J. Crowder a écrit : You're just looking in the wrong place. The second parameter to the onSuccess callback is the value of the X-JSON *header*, if any. It's a means of sending back extra data alongside the main response. You're sending JSON back in the body, not a header. To access that, just look at the `responseJSON` property of the response object (the first parameter to the onSuccess). E.g.: new Ajax.Request(url, { onSuccess: function(response) { // The decoded JSON data is available from // the response.responseJSON property. } }); Ok, I got it. Thanks :o) -- Frédéric -- 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-scriptacul...@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.
[Proto-Scripty] BlindDown/Up rendering wrong
Hi, I'm trying to use the BlindDown/Up effect but it it renders stuttery and weird on all the major (FF 3.5, IE 8, Chrome 4) Browsers. Basically, the background div that is is referenced in the function call, doesn't extend all the way down. It's contents are shown fine. Also, it works fine for the first time, but every susequent BlindDown is borked. Screenshot: http://www.flickr.com/photos/24003...@n00/4203465158/sizes/o/ My suspicion is that there is some stray CSS that the effect doesn't aggree with, but I played around with it in Firebug but couldn't get to the bottom of it. I did make one observation though: Whenever I roll the div up, even in the hidden state it still has a height CSS attribute with a value of something like 80px. If I manually remove the attribute the BlindDown looks as intended. Anybody care to enlighten me as to what I'm doing wrong? -- 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-scriptacul...@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.
Re: [Proto-Scripty] Re: Prototype and IE
Hi T.J. Crowder ajax-content is the only ID for the content element. I am working with Prototype Version: 1.6.0.3 i will read and alter to the proper usage of Class.create. Ps.: ProtoHistoryManager is from one extension that i get in http://scripteka.com/ (Prototype.HistoryManager) Thanks 2009/12/21 T.J. Crowder t...@crowdersoftware.com Hi, I can't address the ProtoHistoryManager stuff, never seen that. But the `getPage` call looks fine. IE has issues with confusing IDs and names; do you have *anything* else on your page with the ID _or_ name ajax-content? [Possibly OT] What version of Prototype are you using? Because your Class.create call doesn't look like it's for the current version of Prototype (1.6.1). Since 1.6.0, you shouldn't replace the prototype on a class you've created with 1.6.x's Class.create. More: http://api.prototypejs.org/language/class.html ] HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Dec 21, 10:12 am, glauber portella glauberporte...@gmail.com wrote: Hello, i am using ajax from prototype and some effects with scriptaculous and i am getting a strange behaviour when it is to be executed in Internet Explorer, my code use prototype history manager and for some reason my contents isn't show in IE, the core of the javascript is listed below: var site = null; var Chiquinho = Class.create(); Chiquinho.prototype = { initialize : function(links) { this.justloaded = true; this.currentLink = undefined; this.links = links; this.contentEl = $('ajax-content'); this.site_urls = { home : '/', empresa : '/empresa', artista : '/artista', agenda : '/agenda', locacao : '/locacao', contrate : '/contrate', depoimento : '/depoimento', parceiro : '/parceiro', contato : '/contato', artista1 : '/artista/show/id/1', artista2 : '/artista/show/id/2', artista3 : '/artista/show/id/3', artista4 : '/artista/show/id/4', artista5 : '/artista/show/id/5', artista6 : '/artista/show/id/6', artista7 : '/artista/show/id/7', artista8 : '/artista/show/id/8', artista9 : '/artista/show/id/9', artista10 : '/artista/show/id/10', artista11 : '/artista/show/id/11', artista12 : '/artista/show/id/12', artista13 : '/artista/show/id/13', artista14 : '/artista/show/id/14', artista15 : '/artista/show/id/15', artista16 : '/artista/show/id/16', artista17 : '/artista/show/id/17', artista18 : '/artista/show/id/18', artista19 : '/artista/show/id/19' }; this.protoHistoryManager = new ProtoHistoryManager(); this.reqHistory = this.protoHistoryManager.register('pages', [ this.links[0] ], // default, page 0 function(values) { var index = this.links.indexOf(values[0]); if (index == 0 this.justloaded) { return; } if (index != -1) { this.justloaded = false; this.linkClick(this.site_urls[values[0]], values[0]); } }.bind(this)); this.protoHistoryManager.start(); }, linkClick : function(url, linkid) { this.currentLink = { url : url, linkid : linkid }; this.cleanContent(); this.reqHistory.setValue(0, linkid); }, cleanContent : function() { new Effect.Appear(this.contentEl, { from : 1.0, to : 0.0, duration : 1.0, afterFinish :
Re: [Proto-Scripty] Re: Prototype and IE
Nothing changed when i rewrite to not replace protoype in Class.create. Any other sugestion to try ?? Thanks 2009/12/21 Glauber Portella glauberporte...@gmail.com Hi T.J. Crowder ajax-content is the only ID for the content element. I am working with Prototype Version: 1.6.0.3 i will read and alter to the proper usage of Class.create. Ps.: ProtoHistoryManager is from one extension that i get in http://scripteka.com/ (Prototype.HistoryManager) Thanks 2009/12/21 T.J. Crowder t...@crowdersoftware.com Hi, I can't address the ProtoHistoryManager stuff, never seen that. But the `getPage` call looks fine. IE has issues with confusing IDs and names; do you have *anything* else on your page with the ID _or_ name ajax-content? [Possibly OT] What version of Prototype are you using? Because your Class.create call doesn't look like it's for the current version of Prototype (1.6.1). Since 1.6.0, you shouldn't replace the prototype on a class you've created with 1.6.x's Class.create. More: http://api.prototypejs.org/language/class.html ] HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Dec 21, 10:12 am, glauber portella glauberporte...@gmail.com wrote: Hello, i am using ajax from prototype and some effects with scriptaculous and i am getting a strange behaviour when it is to be executed in Internet Explorer, my code use prototype history manager and for some reason my contents isn't show in IE, the core of the javascript is listed below: var site = null; var Chiquinho = Class.create(); Chiquinho.prototype = { initialize : function(links) { this.justloaded = true; this.currentLink = undefined; this.links = links; this.contentEl = $('ajax-content'); this.site_urls = { home : '/', empresa : '/empresa', artista : '/artista', agenda : '/agenda', locacao : '/locacao', contrate : '/contrate', depoimento : '/depoimento', parceiro : '/parceiro', contato : '/contato', artista1 : '/artista/show/id/1', artista2 : '/artista/show/id/2', artista3 : '/artista/show/id/3', artista4 : '/artista/show/id/4', artista5 : '/artista/show/id/5', artista6 : '/artista/show/id/6', artista7 : '/artista/show/id/7', artista8 : '/artista/show/id/8', artista9 : '/artista/show/id/9', artista10 : '/artista/show/id/10', artista11 : '/artista/show/id/11', artista12 : '/artista/show/id/12', artista13 : '/artista/show/id/13', artista14 : '/artista/show/id/14', artista15 : '/artista/show/id/15', artista16 : '/artista/show/id/16', artista17 : '/artista/show/id/17', artista18 : '/artista/show/id/18', artista19 : '/artista/show/id/19' }; this.protoHistoryManager = new ProtoHistoryManager(); this.reqHistory = this.protoHistoryManager.register('pages', [ this.links[0] ], // default, page 0 function(values) { var index = this.links.indexOf(values[0]); if (index == 0 this.justloaded) { return; } if (index != -1) { this.justloaded = false; this.linkClick(this.site_urls[values[0]], values[0]); } }.bind(this)); this.protoHistoryManager.start(); }, linkClick : function(url, linkid) { this.currentLink = { url : url, linkid : linkid }; this.cleanContent(); this.reqHistory.setValue(0, linkid); }, cleanContent : function() { new
Re: [Proto-Scripty] Re: Prototype and IE
I updated my prototype and scriptaculous version and the problem didnt go away. I removed the history manager too to see if was a problem with it but it wasn't. Please help me! 2009/12/21 Glauber Portella glauberporte...@gmail.com Nothing changed when i rewrite to not replace protoype in Class.create. Any other sugestion to try ?? Thanks 2009/12/21 Glauber Portella glauberporte...@gmail.com Hi T.J. Crowder ajax-content is the only ID for the content element. I am working with Prototype Version: 1.6.0.3 i will read and alter to the proper usage of Class.create. Ps.: ProtoHistoryManager is from one extension that i get in http://scripteka.com/ (Prototype.HistoryManager) Thanks 2009/12/21 T.J. Crowder t...@crowdersoftware.com Hi, I can't address the ProtoHistoryManager stuff, never seen that. But the `getPage` call looks fine. IE has issues with confusing IDs and names; do you have *anything* else on your page with the ID _or_ name ajax-content? [Possibly OT] What version of Prototype are you using? Because your Class.create call doesn't look like it's for the current version of Prototype (1.6.1). Since 1.6.0, you shouldn't replace the prototype on a class you've created with 1.6.x's Class.create. More: http://api.prototypejs.org/language/class.html ] HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Dec 21, 10:12 am, glauber portella glauberporte...@gmail.com wrote: Hello, i am using ajax from prototype and some effects with scriptaculous and i am getting a strange behaviour when it is to be executed in Internet Explorer, my code use prototype history manager and for some reason my contents isn't show in IE, the core of the javascript is listed below: var site = null; var Chiquinho = Class.create(); Chiquinho.prototype = { initialize : function(links) { this.justloaded = true; this.currentLink = undefined; this.links = links; this.contentEl = $('ajax-content'); this.site_urls = { home : '/', empresa : '/empresa', artista : '/artista', agenda : '/agenda', locacao : '/locacao', contrate : '/contrate', depoimento : '/depoimento', parceiro : '/parceiro', contato : '/contato', artista1 : '/artista/show/id/1', artista2 : '/artista/show/id/2', artista3 : '/artista/show/id/3', artista4 : '/artista/show/id/4', artista5 : '/artista/show/id/5', artista6 : '/artista/show/id/6', artista7 : '/artista/show/id/7', artista8 : '/artista/show/id/8', artista9 : '/artista/show/id/9', artista10 : '/artista/show/id/10', artista11 : '/artista/show/id/11', artista12 : '/artista/show/id/12', artista13 : '/artista/show/id/13', artista14 : '/artista/show/id/14', artista15 : '/artista/show/id/15', artista16 : '/artista/show/id/16', artista17 : '/artista/show/id/17', artista18 : '/artista/show/id/18', artista19 : '/artista/show/id/19' }; this.protoHistoryManager = new ProtoHistoryManager(); this.reqHistory = this.protoHistoryManager.register('pages', [ this.links[0] ], // default, page 0 function(values) { var index = this.links.indexOf(values[0]); if (index == 0 this.justloaded) { return; } if (index != -1) { this.justloaded = false; this.linkClick(this.site_urls[values[0]], values[0]); } }.bind(this)); this.protoHistoryManager.start(); }, linkClick : function(url, linkid) { this.currentLink = { url : url,
[Proto-Scripty] Re: Prototype and IE
Hi, I'm afraid there's nothing much to do other than step through it in a debugger (yes, there _are_ debuggers for IE, the script debugger[1] and Visual Studio) and figure out at what point it's breaking. If you can figure out where it's breaking and post that, we may be able to help. [1] http://www.microsoft.com/downloads/details.aspx?familyid=2f465be0-94fd-4569-b3c4-dffdf19ccd99displaylang=en Sorry not to have a better idea for you... -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Dec 21, 5:00 pm, Glauber Portella glauberporte...@gmail.com wrote: I updated my prototype and scriptaculous version and the problem didnt go away. I removed the history manager too to see if was a problem with it but it wasn't. Please help me! 2009/12/21 Glauber Portella glauberporte...@gmail.com Nothing changed when i rewrite to not replace protoype in Class.create. Any other sugestion to try ?? Thanks 2009/12/21 Glauber Portella glauberporte...@gmail.com Hi T.J. Crowder ajax-content is the only ID for the content element. I am working with Prototype Version: 1.6.0.3 i will read and alter to the proper usage of Class.create. Ps.: ProtoHistoryManager is from one extension that i get in http://scripteka.com/(Prototype.HistoryManager) Thanks 2009/12/21 T.J. Crowder t...@crowdersoftware.com Hi, I can't address the ProtoHistoryManager stuff, never seen that. But the `getPage` call looks fine. IE has issues with confusing IDs and names; do you have *anything* else on your page with the ID _or_ name ajax-content? [Possibly OT] What version of Prototype are you using? Because your Class.create call doesn't look like it's for the current version of Prototype (1.6.1). Since 1.6.0, you shouldn't replace the prototype on a class you've created with 1.6.x's Class.create. More: http://api.prototypejs.org/language/class.html] HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Dec 21, 10:12 am, glauber portella glauberporte...@gmail.com wrote: Hello, i am using ajax from prototype and some effects with scriptaculous and i am getting a strange behaviour when it is to be executed in Internet Explorer, my code use prototype history manager and for some reason my contents isn't show in IE, the core of the javascript is listed below: var site = null; var Chiquinho = Class.create(); Chiquinho.prototype = { initialize : function(links) { this.justloaded = true; this.currentLink = undefined; this.links = links; this.contentEl = $('ajax-content'); this.site_urls = { home : '/', empresa : '/empresa', artista : '/artista', agenda : '/agenda', locacao : '/locacao', contrate : '/contrate', depoimento : '/depoimento', parceiro : '/parceiro', contato : '/contato', artista1 : '/artista/show/id/1', artista2 : '/artista/show/id/2', artista3 : '/artista/show/id/3', artista4 : '/artista/show/id/4', artista5 : '/artista/show/id/5', artista6 : '/artista/show/id/6', artista7 : '/artista/show/id/7', artista8 : '/artista/show/id/8', artista9 : '/artista/show/id/9', artista10 : '/artista/show/id/10', artista11 : '/artista/show/id/11', artista12 : '/artista/show/id/12', artista13 : '/artista/show/id/13', artista14 : '/artista/show/id/14', artista15 : '/artista/show/id/15', artista16 : '/artista/show/id/16', artista17 : '/artista/show/id/17', artista18 : '/artista/show/id/18', artista19 : '/artista/show/id/19' }; this.protoHistoryManager = new ProtoHistoryManager(); this.reqHistory = this.protoHistoryManager.register('pages', [ this.links[0] ], // default, page 0 function(values) { var index =
[Proto-Scripty] Re: Passing the content of an array in a form
For most typical cases, JSON is easier, and more efficient. For one, by sending a Content-type header of application/json you can send an array down from the server, and Prototype automatically converts it into a JSON object you can utilize. Hope that's helpful. There are much better explanations in the API documentation, and people here in the group who can articulate it much better than i. -joe t. On Dec 21, 2:59 am, Frédéric f...@gbiloba.org wrote: On lundi 21 décembre 2009, joe t. wrote: i may be misunderstanding the problem you're describing, but typically when you submit an array of values with the same field name, you want to use [] on the end of the field name. It's possible IE is submitting the array in its object form, which the server is seeing as string [object] and sending back untouched. If the fields are in your HTML, they need an attribute like: input ... name=picts[] / or if the data is managed by your script, and passed in the Ajax.Request as part of the parameters option, you still need to wrap the name into a string: { parameters: { picts[] : picts ... } } Sorry if that's on the wrong track. Thanks for the explanation. I was wondering: a better solution is may be to use json? What do you sthink about? -- Frédéric -- 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-scriptacul...@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.
[Proto-Scripty] Re: Ajax.Request
function show(){alert(get_data_default());} This line will fail when you call show() because you're not passing a function to fill the callback variable inside get_data_default(). Also, method:post and asynchronous:true are the defaults for those options. You don't need to specify them if you plan to keep those settings. -joe t. On Dec 20, 10:47 pm, heeae csche...@gmail.com wrote: I will using this approach function get_data_default(callback){ new Ajax.Request('/adress', { method:'post', asynchronous:true, onSuccess: function(data){ callback(data.responseText.evalJSON (true); }, onFailure: function(){ alert('Something went wrong...') } }); } function show(){alert(get_data_default());} var data = null; function processData(obj){ data = obj; alert(data.abc); } if(data == null){ get_data_default(processData); }else{ alert(data.abc); } On Dec 20, 7:35 pm, kangur91 kangu...@gmail.com wrote: My code: function get_data_default() { new Ajax.Request('/adress', { method:'post', asynchronous:true, onSuccess: function(data){ return data.responseText.evalJSON (true); }, onFailure: function(){ alert('Something went wrong...') } });} } function show(){alert(get_data_default());} I want to function get_data_default return data recived from OnSucces function. How do that? -- 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-scriptacul...@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.
[Proto-Scripty] Re: Ajax.Request
sorry for typing mistake, I am intended to represent the concept of using callback. and I think keeping default variable is not bad as we cant tell the default value not to be changed in the next generation of prototype js. heeae On Dec 22, 1:25 pm, joe t. thooke...@gmail.com wrote: function show(){alert(get_data_default());} This line will fail when you call show() because you're not passing a function to fill the callback variable inside get_data_default(). Also, method:post and asynchronous:true are the defaults for those options. You don't need to specify them if you plan to keep those settings. -joe t. On Dec 20, 10:47 pm, heeae csche...@gmail.com wrote: I will using this approach function get_data_default(callback){ new Ajax.Request('/adress', { method:'post', asynchronous:true, onSuccess: function(data){ callback(data.responseText.evalJSON (true); }, onFailure: function(){ alert('Something went wrong...') } }); } function show(){alert(get_data_default());} var data = null; function processData(obj){ data = obj; alert(data.abc); } if(data == null){ get_data_default(processData); }else{ alert(data.abc); } On Dec 20, 7:35 pm, kangur91 kangu...@gmail.com wrote: My code: function get_data_default() { new Ajax.Request('/adress', { method:'post', asynchronous:true, onSuccess: function(data){ return data.responseText.evalJSON (true); }, onFailure: function(){ alert('Something went wrong...') } });} } function show(){alert(get_data_default());} I want to function get_data_default return data recived from OnSucces function. How do that? -- 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-scriptacul...@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.