Hi I''m currently learning how AJAX is working and found prototype.js interesting. But I have some issues that might be because of misusage: http://brasilia.nersc.no/test/PyTest/AJAX.html When I use this in Firefox2 it correctly fills the first select, using opera9 it is filled, but it just shows a list of "blank" options (no description), and in IE6 it doesn''t get filled at all. I use python in the backend, and feeding it the input it replies correctly in all browsers: http://brasilia.nersc.no/test/PyTest/AJAX.py/getDatasetOptions This is my code: new Ajax.Updater({ success:''dataset'', failure:''image'' }, ''AJAX.py/getDatasetOptions'', { method:''get'', parameters:$H({ random:Math.random() }), insertion: Insertion.Bottom } ); Any help appreciated. Thanks! ### For those interested; this will be an open source visualisation tool for generating images of climate data using dods/THREDDS in the back. (that is why I use python in the back, it makes it possible to talk easily with the THREDDS server.) -- Bjørge --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Tried your page out (1st link in the email below) and I received JS errors about an undefined function isArray as well as 404 errors from the actual AJAX requests. -Andrew Martinez -----Original Message----- From: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-spinoffs@googlegroups.com]On Behalf Of Bjørge Solli Sent: Monday, February 12, 2007 11:35 AM To: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Subject: [Rails-spinoffs] prototype.js and different browsers Hi I''m currently learning how AJAX is working and found prototype.js interesting. But I have some issues that might be because of misusage: http://brasilia.nersc.no/test/PyTest/AJAX.html When I use this in Firefox2 it correctly fills the first select, using opera9 it is filled, but it just shows a list of "blank" options (no description), and in IE6 it doesn''t get filled at all. I use python in the backend, and feeding it the input it replies correctly in all browsers: http://brasilia.nersc.no/test/PyTest/AJAX.py/getDatasetOptions This is my code: new Ajax.Updater({ success:''dataset'', failure:''image'' }, ''AJAX.py/getDatasetOptions'', { method:''get'', parameters:$H({ random:Math.random() }), insertion: Insertion.Bottom } ); Any help appreciated. Thanks! ### For those interested; this will be an open source visualisation tool for generating images of climate data using dods/THREDDS in the back. (that is why I use python in the back, it makes it possible to talk easily with the THREDDS server.) -- Bjørge --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Man have I got just what you need! http://colin.mollenhour.com/doublecombo/index.html However, I don''t think I accounted for optgroups.. I''m sure this could be made to work though. Either way, you will have to use a DOM method like mine, innerHTML for selects does not work on some browsers, period. Thanks, Colin Bjørge Solli wrote:> Hi > > I''m currently learning how AJAX is working and found prototype.js interesting. > But I have some issues that might be because of misusage: > > http://brasilia.nersc.no/test/PyTest/AJAX.html > When I use this in Firefox2 it correctly fills the first select, using opera9 > it is filled, but it just shows a list of "blank" options (no description), > and in IE6 it doesn''t get filled at all. > > I use python in the backend, and feeding it the input it replies correctly in > all browsers: > http://brasilia.nersc.no/test/PyTest/AJAX.py/getDatasetOptions > > This is my code: > new Ajax.Updater({ success:''dataset'', failure:''image'' }, > ''AJAX.py/getDatasetOptions'', > { method:''get'', parameters:$H({ random:Math.random() }), insertion: > Insertion.Bottom } > ); > > Any help appreciated. > Thanks! > > ### > For those interested; this will be an open source visualisation tool for > generating images of climate data using dods/THREDDS in the back. (that is > why I use python in the back, it makes it possible to talk easily with the > THREDDS server.) > >--~--~---------~--~----~------------~-------~--~----~ 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. The isArray error was my mistake, i thought this was native. Got it from http://javascript.crockford.com/remedial.html , but didn''t read the whole thing. Fixed now. The second error is due to incompleteness. I am struggelign with filling the uppermost select and don''t want to go further until I am satisfied. So when you actually select something in the dropdown menu I expect it to show an error at the bottom. -bs On Monday 12 February 2007 17:46, Martinez, Andrew wrote:> Tried your page out (1st link in the email below) and I received JS errors > about an undefined function isArray as well as 404 errors from the actual > AJAX requests. > > -Andrew Martinez > > -----Original Message----- > From: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [mailto:rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org]On Behalf Of Bjørge Solli > Sent: Monday, February 12, 2007 11:35 AM > To: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > Subject: [Rails-spinoffs] prototype.js and different browsers > > > Hi > > I''m currently learning how AJAX is working and found prototype.js > interesting. But I have some issues that might be because of misusage: > > http://brasilia.nersc.no/test/PyTest/AJAX.html > When I use this in Firefox2 it correctly fills the first select, using > opera9 it is filled, but it just shows a list of "blank" options (no > description), and in IE6 it doesn''t get filled at all. > > I use python in the backend, and feeding it the input it replies correctly > in all browsers: > http://brasilia.nersc.no/test/PyTest/AJAX.py/getDatasetOptions > > This is my code: > new Ajax.Updater({ success:''dataset'', failure:''image'' }, > ''AJAX.py/getDatasetOptions'', > { method:''get'', parameters:$H({ random:Math.random() }), > insertion: Insertion.Bottom } > ); > > Any help appreciated. > Thanks! > > ### > For those interested; this will be an open source visualisation tool for > generating images of climate data using dods/THREDDS in the back. (that is > why I use python in the back, it makes it possible to talk easily with the > THREDDS server.) > > -- > Bjørge > > >-- Bjørge --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hmm. Is this "some browsers" every browser exept FF? Well, I can''t live with that, even how much I like that browser. Is the best solution, except for using a different package, to simply use AJAX.Request with a onSuccess:function(transport){ fillSelect(''dataset'', transport.responseText); } and have something like this (pseudocode) function fillSelect(sel,str) { arr = str.split('';''); for foo in arr { make option-object foo add option-object foo to select sel } } What do you guys think of this approach? It is putting a lot more work to the browser, but this should be so little that it will take fractions of a second on even an old computer. I''m interested in "best practices answers" too. Regards Bjørge On Monday 12 February 2007 19:16, Colin Mollenhour wrote:> Man have I got just what you need! > http://colin.mollenhour.com/doublecombo/index.html > > However, I don''t think I accounted for optgroups.. I''m sure this could > be made to work though. Either way, you will have to use a DOM method > like mine, innerHTML for selects does not work on some browsers, period. > > Thanks, > Colin > > Bjørge Solli wrote: > > Hi > > > > I''m currently learning how AJAX is working and found prototype.js > > interesting. But I have some issues that might be because of misusage: > > > > http://brasilia.nersc.no/test/PyTest/AJAX.html > > When I use this in Firefox2 it correctly fills the first select, using > > opera9 it is filled, but it just shows a list of "blank" options (no > > description), and in IE6 it doesn''t get filled at all. > > > > I use python in the backend, and feeding it the input it replies > > correctly in all browsers: > > http://brasilia.nersc.no/test/PyTest/AJAX.py/getDatasetOptions > > > > This is my code: > > new Ajax.Updater({ success:''dataset'', failure:''image'' }, > > ''AJAX.py/getDatasetOptions'', > > { method:''get'', parameters:$H({ random:Math.random() }), insertion: > > Insertion.Bottom } > > ); > > > > Any help appreciated. > > Thanks! > > > > ### > > For those interested; this will be an open source visualisation tool for > > generating images of climate data using dods/THREDDS in the back. (that > > is why I use python in the back, it makes it possible to talk easily with > > the THREDDS server.) > >-- Bjørge --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Speed is really a non-issue here. Only if you had a HUGE response would you notice a delay (other than ping time), and at that point you would have usability problems anyway... I highly recommend using JSON with a data structure like I did in Ajax.DoubleCombo if you aren''t going to use it in the first place (why not?). Like I said you will need to modify it to support optgroup if you need support for those, I don''t currently have the time or need to do it myself. Creating that data-structure server-side is VERY easy with any language that has a JSON library (probably all). Colin Bjørge Solli wrote:> Hmm. Is this "some browsers" every browser exept FF? Well, I can''t live with > that, even how much I like that browser. Is the best solution, except for > using a different package, to simply use AJAX.Request with a > onSuccess:function(transport){ fillSelect(''dataset'', > transport.responseText); } > > and have something like this (pseudocode) > function fillSelect(sel,str) { > arr = str.split('';''); > for foo in arr { > make option-object foo > add option-object foo to select sel > } > } > > What do you guys think of this approach? It is putting a lot more work to the > browser, but this should be so little that it will take fractions of a second > on even an old computer. I''m interested in "best practices answers" too. > > Regards > Bjørge > > On Monday 12 February 2007 19:16, Colin Mollenhour wrote: > >> Man have I got just what you need! >> http://colin.mollenhour.com/doublecombo/index.html >> >> However, I don''t think I accounted for optgroups.. I''m sure this could >> be made to work though. Either way, you will have to use a DOM method >> like mine, innerHTML for selects does not work on some browsers, period. >> >> Thanks, >> Colin >> >> Bjørge Solli wrote: >> >>> Hi >>> >>> I''m currently learning how AJAX is working and found prototype.js >>> interesting. But I have some issues that might be because of misusage: >>> >>> http://brasilia.nersc.no/test/PyTest/AJAX.html >>> When I use this in Firefox2 it correctly fills the first select, using >>> opera9 it is filled, but it just shows a list of "blank" options (no >>> description), and in IE6 it doesn''t get filled at all. >>> >>> I use python in the backend, and feeding it the input it replies >>> correctly in all browsers: >>> http://brasilia.nersc.no/test/PyTest/AJAX.py/getDatasetOptions >>> >>> This is my code: >>> new Ajax.Updater({ success:''dataset'', failure:''image'' }, >>> ''AJAX.py/getDatasetOptions'', >>> { method:''get'', parameters:$H({ random:Math.random() }), insertion: >>> Insertion.Bottom } >>> ); >>> >>> Any help appreciated. >>> Thanks! >>> >>> ### >>> For those interested; this will be an open source visualisation tool for >>> generating images of climate data using dods/THREDDS in the back. (that >>> is why I use python in the back, it makes it possible to talk easily with >>> the THREDDS server.) >>> >>--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi again Colin, I really like your doublecombo, I learned a lot reading it. But it doesn''t solve my problem of populating *the first* select. It will solve the populating of the second and third select. That is why I can''t use it (for the first select). I have also read up on JSON, and it seems a lot more sensible than my suggestion of a semicolon-separated string, but basically the idea is the same, but he syntax more elaborate and extensible. It seems I have to do the code for the first select "by hand", and then I can use doublecombo for the second and third (which also don''t need optgroups). I hope this was clear on why I cannot use doublecombo for the problem I am *currently* struggling with. Please let me know if I have misunderstood something. Bjørge On Tuesday 13 February 2007 16:16, Colin Mollenhour wrote:> Speed is really a non-issue here. Only if you had a HUGE response would > you notice a delay (other than ping time), and at that point you would > have usability problems anyway... I highly recommend using JSON with a > data structure like I did in Ajax.DoubleCombo if you aren''t going to use > it in the first place (why not?). Like I said you will need to modify it > to support optgroup if you need support for those, I don''t currently > have the time or need to do it myself. Creating that data-structure > server-side is VERY easy with any language that has a JSON library > (probably all). > > Colin > > Bjørge Solli wrote: > > Hmm. Is this "some browsers" every browser exept FF? Well, I can''t live > > with that, even how much I like that browser. Is the best solution, > > except for using a different package, to simply use AJAX.Request with a > > onSuccess:function(transport){ fillSelect(''dataset'', > > transport.responseText); } > > > > and have something like this (pseudocode) > > function fillSelect(sel,str) { > > arr = str.split('';''); > > for foo in arr { > > make option-object foo > > add option-object foo to select sel > > } > > } > > > > What do you guys think of this approach? It is putting a lot more work to > > the browser, but this should be so little that it will take fractions of > > a second on even an old computer. I''m interested in "best practices > > answers" too. > > > > Regards > > Bjørge > > > > On Monday 12 February 2007 19:16, Colin Mollenhour wrote: > >> Man have I got just what you need! > >> http://colin.mollenhour.com/doublecombo/index.html > >> > >> However, I don''t think I accounted for optgroups.. I''m sure this could > >> be made to work though. Either way, you will have to use a DOM method > >> like mine, innerHTML for selects does not work on some browsers, period. > >> > >> Thanks, > >> Colin > >> > >> Bjørge Solli wrote: > >>> Hi > >>> > >>> I''m currently learning how AJAX is working and found prototype.js > >>> interesting. But I have some issues that might be because of misusage: > >>> > >>> http://brasilia.nersc.no/test/PyTest/AJAX.html > >>> When I use this in Firefox2 it correctly fills the first select, using > >>> opera9 it is filled, but it just shows a list of "blank" options (no > >>> description), and in IE6 it doesn''t get filled at all. > >>> > >>> I use python in the backend, and feeding it the input it replies > >>> correctly in all browsers: > >>> http://brasilia.nersc.no/test/PyTest/AJAX.py/getDatasetOptions > >>> > >>> This is my code: > >>> new Ajax.Updater({ success:''dataset'', failure:''image'' }, > >>> ''AJAX.py/getDatasetOptions'', > >>> { method:''get'', parameters:$H({ random:Math.random() }), > >>> insertion: Insertion.Bottom } > >>> ); > >>> > >>> Any help appreciated. > >>> Thanks! > >>> > >>> ### > >>> For those interested; this will be an open source visualisation tool > >>> for generating images of climate data using dods/THREDDS in the back. > >>> (that is why I use python in the back, it makes it possible to talk > >>> easily with the THREDDS server.) > >-- Bjørge --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---