Hi there, I have a question i let my ul list build by a javascript: -------------------------------------------------------------------------------------------------------------------- function listItems(itemList) // build ul list with array { document.write("<UL id=\"sortable_list\">\n") for (i = 0;i < itemList.length;i++) { document.write("<LI>" + itemList[i] + "\n") } document.write("</UL>\n") } // End hiding JavaScript --> </script> -------------------------------------------------------------------------------------------------------------------- That code is in <head> tag and gets its li items from an array. In the between they <body></body> tags i have : -------------------------------------------------------------------------------------------------------------------- function schop(){ // fuction with a simple debug / test message. var days = document.getElementById(''tijdelijk''); if (days.value !="") alert(days.value) else alert("geen waarde") listItems(list) // place the ul list here! } </SCRIPT> <script language="JavaScript"> Sortable.create("sortable_list"); //start scriptalicious </script> -------------------------------------------------------------------------------------------------------------------- I get my ul list filled by the array but scriptalicous doesn''t work i think the reason is that you dont see the ul and li in flat html code. Can someone assist me please to get this work anyway or give me a clue. The error i get from my javascript debugger is : NULL value = line 470 in prototype.js. I tried to put the ul tags around my javascript that is in between my <body> tags and yes then that error goes away but it cant find the elements li to sort which are created by the document.write in the <head> section. Hope anyone can help. Greets ph34r --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Run Sortable.create("sortable_list"); on the onload event of the page. You can''t create the sortable until the elements are rendered on the page. On Jul 5, 9:02 am, "ZT.Ph34rl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <ZT.Ph34rl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi there, > > I have a question i let my ul list build by a javascript: > -------------------------------------------------------------------------------------------------------------------- > > function listItems(itemList) // build ul list > with array > { > document.write("<UL id=\"sortable_list\">\n") > for (i = 0;i < itemList.length;i++) > { > document.write("<LI>" + itemList[i] + "\n") > } > document.write("</UL>\n")} > > // End hiding JavaScript --> > </script> > > -------------------------------------------------------------------------------------------------------------------- > That code is in <head> tag and gets its li items from an array. > > In the between they <body></body> tags i have : > -------------------------------------------------------------------------------------------------------------------- > > function schop(){ // > fuction with a simple debug / test message. > var days = document.getElementById(''tijdelijk''); > if (days.value !="") > alert(days.value) > else > alert("geen waarde") > > listItems(list) // > place the ul list here! > > } > > </SCRIPT> > <script language="JavaScript"> > Sortable.create("sortable_list"); //start > scriptalicious > </script> > -------------------------------------------------------------------------------------------------------------------- > > I get my ul list filled by the array but scriptalicous doesn''t work i > think the reason is that you dont see the ul and li in flat html code. > Can someone assist me please to get this work anyway or give me a > clue. > The error i get from my javascript debugger is : > > NULL value = line 470 in prototype.js. > > I tried to put the ul tags around my javascript that is in between my > <body> tags and yes then that error goes away but it cant find the > elements li to sort which are created by the document.write in the > <head> section. > > Hope anyone can help. > > Greets > > ph34r--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thank you, that did the trick :) So close yet so fare greets ph34r On Jul 5, 9:30 pm, Diodeus <diod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Run Sortable.create("sortable_list"); on the onload event of the > page. You can''t create the sortable until the elements are rendered on > the page. > > On Jul 5, 9:02 am, "ZT.Ph34rl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <ZT.Ph34rl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > Hi there, > > > I have a question i let my ul list build by a javascript: > > --------------------------------------------------------------------------- ----------------------------------------- > > > function listItems(itemList) // build ul list > > with array > > { > > document.write("<UL id=\"sortable_list\">\n") > > for (i = 0;i < itemList.length;i++) > > { > > document.write("<LI>" + itemList[i] + "\n") > > } > > document.write("</UL>\n")} > > > // End hiding JavaScript --> > > </script> > > > --------------------------------------------------------------------------- ----------------------------------------- > > That code is in <head> tag and gets its li items from an array. > > > In the between they <body></body> tags i have : > > --------------------------------------------------------------------------- ----------------------------------------- > > > function schop(){ // > > fuction with a simple debug / test message. > > var days = document.getElementById(''tijdelijk''); > > if (days.value !="") > > alert(days.value) > > else > > alert("geen waarde") > > > listItems(list) // > > place the ul list here! > > > } > > > </SCRIPT> > > <script language="JavaScript"> > > Sortable.create("sortable_list"); //start > > scriptalicious > > </script> > > --------------------------------------------------------------------------- ----------------------------------------- > > > I get my ul list filled by the array but scriptalicous doesn''t work i > > think the reason is that you dont see the ul and li in flat html code. > > Can someone assist me please to get this work anyway or give me a > > clue. > > The error i get from my javascript debugger is : > > > NULL value = line 470 in prototype.js. > > > I tried to put the ul tags around my javascript that is in between my > > <body> tags and yes then that error goes away but it cant find the > > elements li to sort which are created by the document.write in the > > <head> section. > > > Hope anyone can help. > > > Greets > > > ph34r--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---