[Proto-Scripty] Encoding problem with new Ajax.Request
I've a small problem with new Ajax.Request. Actually, there isn't really a problem with the function itself, but with encoding. Here is my code: function getData() { new Ajax.Request('chat.php', { method: 'post', encoding: 'windows-1251', parameters: userId= + userId + msgtime= + msgtime, onComplete: function(getDataRequest) { if (getDataRequest.responseText.substr(0,1) == |) { clearTimeout(yo); alert(getDataRequest.responseText.substr(1,getDataRequest.responseText.length - 1)); exit(); } else { var lines = getDataRequest.responseText.split('\n'); lines.length = lines.length - 1; if (lines.length 0) { onlineUserList = lines[0].split(|); onlineUserList.length = onlineUserList.length - 1; } if (lines.length 1) { for (i = 1; i lines.length; i++) { var msg = lines[i].split(|); try { parent.talk.printmsg(msg[0],msg[1],msg[2],msg[3]); } catch (e) { } msgtime = msg[4]; } } seichas = document.getElementById(chatlan); mysp = document.createElement(span); hrprfr = document.createTextNode(ЮЗЕРОВ ОНЛАЙН: + onlineUserList.length); mysp.appendChild(hrprfr); seichas.replaceChild(hrprfr, seichas.firstChild); parent.menu.printmenu(); } yo = setTimeout('getData()', chatTimeout); }, onFailure: function(transport) { alert('XHR failed!\nReason:' + transport.responseText) } } ); } The problem is in: msgtime= + msgtime Msgtime is selected from the database before it is sent. In the table, Msgtime type is TIME, which shows current time in H:i:s (hours, minutes, seconds). I've debugged the request with SoftX HTTP Debugger, and here's the request: POST /chat.php HTTP/1.1 Accept: text/javascript, text/html, application/xml, text/xml, */* Accept-Language: sv x-prototype-version: 1.6.0.3 Referer: http://www.talk.ee/ x-requested-with: XMLHttpRequest Content-Type: application/x-www-form-urlencoded; charset=windows-1251 UA-CPU: x86 Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; InfoPath. 1; .NET CLR 1.1.4322) Host: www.talk.ee Content-Length: 29 Connection: Keep-Alive Cache-Control: no-cache Cookie: N=Uzm; PHPSESSID=8a8ebf98310cf9ed6f3ea0e8091a1904 userId=1msgtime=21%3A09%3A48 As you can see, msgtime is 21%3A09%3A48, althought it should be 21:09:48. I've triend with encodeURIcomponent(), but it doesn't seem to work. Could you guys help me out with this one? Thanks. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] IE6 Error
Hello, I'm using protoype.js in a rails application. The application works fine on Safari, FireFox (both windows and mac), however, when I load my app in IE6, I get an Error: Object doesn't support this property or method pop up. When I choose to debug that in the script debugger, I see that the error is on the line which says element.fireEvent(event.eventType, event); which seems to be in a method with a fire: symbol at the beginning. (I'm not a javascript guru, I don't recognize that syntax) I've tried getting 1.6.0.3 from the web site, and also tried getting the latest from github, and building it and deploying that. Still the problem persists. Does anyone have any idea of how to handle this? Thanks, John Schank --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Limit Drag and Drop on browser screen
Dear All... How to make drag and drop an element but it is not dragged over limit height and width browser size, it likes drag and drop on gmail's windows modal message... Thanks, Best Regards Saiful Amri --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: IE6 Error
Hi John, This usually happens when you try to call a Prototype method on an Element instance that hasn't been extended [passed through $()]. On almost everything but IE, that's fine, but on IE you have to be sure to pass the instance through $(). There's an article on this in the new unofficial Prototype script.aculo.us wiki, in the Troubleshooting section: http://proto-scripty.wikidot.com/prototype:object-doesn-t-support-this-property-or-method If you give that a quick read and then look at your application code that's calling into Prototype when the error occurs, you'll probably see where the missing $() should go. More about the general topic of extending elements here: http://www.prototypejs.org/learn/extensions HTH, -- T.J. Crowder tj / crowder software / com On Oct 20, 11:57 pm, jschank [EMAIL PROTECTED] wrote: Hello, I'm using protoype.js in a rails application. The application works fine on Safari, FireFox (both windows and mac), however, when I load my app in IE6, I get an Error: Object doesn't support this property or method pop up. When I choose to debug that in the script debugger, I see that the error is on the line which says element.fireEvent(event.eventType, event); which seems to be in a method with a fire: symbol at the beginning. (I'm not a javascript guru, I don't recognize that syntax) I've tried getting 1.6.0.3 from the web site, and also tried getting the latest from github, and building it and deploying that. Still the problem persists. Does anyone have any idea of how to handle this? Thanks, John Schank --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Encoding problem with new Ajax.Request
Dear... try using msgtime=+encodeURIComponent(msgtime) I think it does work, thanks Saiful Amri On Tue, Oct 21, 2008 at 1:12 AM, Uzm [EMAIL PROTECTED] wrote: I've a small problem with new Ajax.Request. Actually, there isn't really a problem with the function itself, but with encoding. Here is my code: function getData() { new Ajax.Request('chat.php', { method: 'post', encoding: 'windows-1251', parameters: userId= + userId + msgtime= + msgtime, onComplete: function(getDataRequest) { if (getDataRequest.responseText.substr(0,1) == |) { clearTimeout(yo); alert(getDataRequest.responseText.substr(1,getDataRequest.responseText.length - 1)); exit(); } else { var lines = getDataRequest.responseText.split('\n'); lines.length = lines.length - 1; if (lines.length 0) { onlineUserList = lines[0].split(|); onlineUserList.length = onlineUserList.length - 1; } if (lines.length 1) { for (i = 1; i lines.length; i++) { var msg = lines[i].split(|); try { parent.talk.printmsg(msg[0],msg[1],msg[2],msg[3]); } catch (e) { } msgtime = msg[4]; } } seichas = document.getElementById(chatlan); mysp = document.createElement(span); hrprfr = document.createTextNode(ЮЗЕРОВ ОНЛАЙН: + onlineUserList.length); mysp.appendChild(hrprfr); seichas.replaceChild(hrprfr, seichas.firstChild); parent.menu.printmenu(); } yo = setTimeout('getData()', chatTimeout); }, onFailure: function(transport) { alert('XHR failed!\nReason:' + transport.responseText) } } ); } The problem is in: msgtime= + msgtime Msgtime is selected from the database before it is sent. In the table, Msgtime type is TIME, which shows current time in H:i:s (hours, minutes, seconds). I've debugged the request with SoftX HTTP Debugger, and here's the request: POST /chat.php HTTP/1.1 Accept: text/javascript, text/html, application/xml, text/xml, */* Accept-Language: sv x-prototype-version: 1.6.0.3 Referer: http://www.talk.ee/ x-requested-with http://www.talk.ee/x-requested-with: XMLHttpRequest Content-Type: application/x-www-form-urlencoded; charset=windows-1251 UA-CPU: x86 Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; InfoPath. 1; .NET CLR 1.1.4322) Host: www.talk.ee Content-Length: 29 Connection: Keep-Alive Cache-Control: no-cache Cookie: N=Uzm; PHPSESSID=8a8ebf98310cf9ed6f3ea0e8091a1904 userId=1msgtime=21%3A09%3A48 As you can see, msgtime is 21%3A09%3A48, althought it should be 21:09:48. I've triend with encodeURIcomponent(), but it doesn't seem to work. Could you guys help me out with this one? Thanks. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Help needed
[code] parent page ul id=tablist liSome text/li /ul child page(loaded in a div) ul id=tablist liChild some text/li /ul [/code] [css] #tablist{ padding:3px 0; margin-left:0; margin-bottom:0; margin-top:0.1em; font:bold 12px Verdana, Arial, Helvetica, sans-serif; border-bottom:1px solid gray; } #tablist li{ list-style:none; display:inline; margin:0; } [/css] This my code and css listing... On Mon, Oct 20, 2008 at 4:17 PM, T.J. Crowder [EMAIL PROTECTED]wrote: Hi, considerations: 2 ul elements sharing id because of css styling. Not really, right? You mean they're sharing the same class or some such? You can't have two elements on a page with the same ID; IDs are required to be unique across the DOM. FWIW, -- T.J. Crowder tj / crowder software / com On Oct 20, 12:40 pm, jason maina [EMAIL PROTECTED] wrote: [code] function monitorMgr(){ var myLi=$$('ul.flMgr li'); myLi.each(function(liItem){ Event.observe(liItem, 'click', anFunction, false); }); } function anFunction(evt){ alert($(evt).id);} [/code] response: undefined expected result: the clicked li's id considerations: 2 ul elements sharing id because of css styling. This page is loaded in a div residing in another page 'parent page'. Which way out? Regards -jason -- Sent from Gmail for mobile | mobile.google.com --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Form field validation and masking
Thanks, I found what I was looking for form validation. Any suggestion for masking? Tom On 20 Říj, 17:52, kangax [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Hi, do you know some prototypejs based alternative to fValidator (http:// zendold.lojcomm.com.br/fvalidator/) and iMask (http:// zendold.lojcomm.com.br/imask/)? Thanks a lot Have you checkedhttp://scripteka.com? Regars, Tom -- kangax --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Encoding problem with new Ajax.Request
If that's the only problem, why not deal with it on the server. I see that you're using PHP. That would be as easy as: $msgtime = str_replace('%3A',':',$_REQUEST['msgtime']); Considering that message is received by the server-side script almost instantly, you could forgo sending the time at all and instead determine the time on the server: $msgtime = date('H:i:s'); Additionally, setting { encoding: 'windows-1251' } doesn't really do much as request is sent in UTF-8 and encoding of the reponse is determited by what encoding is set by the server. In order to be able to receive Windows-1251 you should set encoding for the message in your script: header('Content-type: text/html; charset=windows-1251'); Tho it's not really my business, I'd suggest you to think about parameters you're sending. You're passing userId as a parameter to the server which means that anyone could fake such a request and pose as a different user. I'd use sessions instead. Good luck with the service - Baglan --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: I use Updater with a webpage in different folder. I can't see images
Why don't you use paths to your images that are relative to the webroot instead of the directory they are in so that they work no matter where they are? The convention is to have a directory in your webroot called images and all your imagery goes in there. /images/c1/foo.jpg /images/c2/bar.jpg img src=/images/c1/foo.jpg / -justin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: I use Updater with a webpage in different folder. I can't see images
My Advice? Forget ajax and use an iframe or heck, even standard frames. In my opinion, you are trying to use a screw driver when you should be using a hammer. On Tue, Oct 21, 2008 at 1:36 PM, F. Ruiz [EMAIL PROTECTED] wrote: Thank you for your answer, but this is not valid for me. I'll try to explain you. I work with many people. Each one makes in his computer his onw web page (pag2.html, pag3.html, ...), maybe with many images. Each web page will go in a different folder (c2, c3, ...). Using menus in pag1.html (main page), I'd like to see all of them. I don't want to edit each web page !! I know where is each one and I'd like to update their img src when I bring them to pag1.html with prototype. Maybe something like this: /*For menu 2*/ var oRequest = new Ajax.Updater('mydiv', 'c2/pag2.html', {method:'get', parameters:''} ); update_img...('mydiv', 'src=', 'src=c2/') /*For menu 3*/ var oRequest = new Ajax.Updater('mydiv', 'c3/pag3.html', {method:'get', parameters:''} ); update_img...('mydiv', 'src=', 'src=c3/') ... Maybe this is easy to do, but I'm a beginner with prototype (And sorry for me English, I'm learning it now) On 21 oct, 15:57, Justin Perkins [EMAIL PROTECTED] wrote: Why don't you use paths to your images that are relative to the webroot instead of the directory they are in so that they work no matter where they are? The convention is to have a directory in your webroot called images and all your imagery goes in there. /images/c1/foo.jpg /images/c2/bar.jpg img src=/images/c1/foo.jpg / -justin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: PeriodicalExecuter vs. Ajax.PeriodicalUpdater: use cases and advice?
I would imagine that Ajax.PeriodicalUpdater was conceived with a different intention in mind - something like showing online/offline status, maybe. All the chat-like examples I've seen (primarily for the RoR), used javascript generated on the server to re-start updating and sessions to keep track of updates - never a PeriodicalUpdater or PeriodicalExecuter. I guess it makes sense to keep that functionality on the server side. - Baglan --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] trouble with delayedobserver
Here's the code. It's simple enough: blockquote new Form.Element.DelayedObserver( 'inputfield', .50, function() { simplefunction(); }) function simplefunction() { alert(here I am); } /blockquote The problem I'm having is that simplefunction is being called twice. Best Adam --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: PeriodicalExecuter vs. Ajax.PeriodicalUpdater: use cases and advice?
Why aren't you just using the Ajax.PeriodicalUpdater, which supports the decay option? var poller = new Ajax.PeriodicalUpdater('some-element-id', '/foo/bar', {decay:10}); Also, if you pass an empty string as the first parameter, then you can pass pure JavaScript to be executed as opposed to just replacing the contents of a page element. -justin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: IE6 Error
Hi T.J. Thanks for the reply. I've read the docs at the links you mention, but I'm still stuck. The problem (with me anyway) is that I'm a JavaScript noob, and the JavaScript calls that exist in my app get there via Rails. So I'm having a problem even finding the offending function. It seems to me that the call that is failing - the dom:loaded event is one that is set up automatically as part of using Rails. Does this sound likely? If so, do you have any ideas where I might be looking in my code. The only javascript that I explicitly created uses jQuery and as far as I can tell already wraps the access to elements in the $() as recommended. And doesn't have anything to do with document loading. Thanks, John --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: IE6 Error
T.J. I thought I'd add the clip of the only JavaScript code that I'm responsible for: (in case the problem is therein) $(document).ready(function() { // Build tabs... $('#tabs ul').tabs({ fx: { height: 'toggle', opacity: 'toggle' } }); // Animate the hiding of any flash elements... $(div.flash).show(drop, { direction: up}, 1000); setTimeout( function(){$(div.flash).hide(scale, {}, 1000);}, 5000); }); I'm certainly fine with digging into the Rails code to fix the problem, if it is there, I just don't have enough experience with Rails to know where to look. I think I'll try commenting out my javascript code, and see if deployment still fails on IE6. That should help nail down where the code is that needs to be fixed. (mine - or something I've inherited from Rails, or one of the plugins I'm using) Thanks again, John --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: IE6 Error
T.J. I did the remove of my JavaScript, and I still get the error. So it must be a problem with Rails or one of the plugins. I'll poke around on their boards and fora to see if they have mention of this. Thanks, John --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: PeriodicalExecuter vs. Ajax.PeriodicalUpdater: use cases and advice?
Well since the Ajax requests in Prototype will auto-eval the response, you can modify the page without updating just one div. It's the route I take most of the time. Say you set it up like this: new Ajax.PeriodicalUpdater('', '/some/url'); Then the response from /some/url could be: $('some-element').blindUp({duration:0.5); // wait for the blind up to complete before replacing the content Element.update.delay(0.5, 'some-element', 'pmy new content/p'); // wait for the blind up to complete, then wait a 10th of a second longer Element.blindDown.delay(0.6, 'some-element', {duration:0.5}); You get the idea. I find it more flexible and convenient than updating just a single element. You could alternatively call into some predefined object/method to do this work. Some people might be opposed to this approach, but it works. -justin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: IE6 Error
Ok, I've solved this... Apparently, the problem stems from trying to use both prototype AND jQuery on the same page. I thought I needed prototype for active_scaffold (AS does require prototype) but I was able to remove both active_scaffold and prototype from my app. Now I no longer get the Object doesn't support... error in IE6. Of course, this being IE6, I now get a different error in swfobject.js for my charts. Funny how Safari and FF don't have these problems. Thanks for the help T.J. John --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---