Assuming that $(ids[i]) is the hidden input field, wouldn''t the following line need to reference it as a form element?> $(ids[i]).innerHTML = i;I would assume it should be (the "'''' + " makes it a string, not sure if you can set a form element value to an int, maybe you can): $(ids[i]).value = '''' + i; Or maybe I''m not understanding the code. Greg
ids is an array of all elements with the class name of ''linkIndexNumber'' which is only the hidden fields. i figured that getElementsByClassName would return them in the order they appear on the page, so i am using that to base which number they are in the list. then i am setting each of them to the value. ids[i] would be the item inside the id array. maybe there is a better wat to do this that i am not thinking of.> Assuming that $(ids[i]) is the hidden input field, wouldn''t the > following line need to reference it as a form element? >> $(ids[i]).innerHTML = i; > > > I would assume it should be (the "'''' + " makes it a string, not sure if > you can set a form element value to an int, maybe you can): > $(ids[i]).value = '''' + i; > > Or maybe I''m not understanding the code. > > Greg > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
Well, if they are hidden input fields, then I''m not sure you can use innerHTML (all self-enclosed tags should have no innerHTML). You need to set the value on them (ids[i].value = '''' + i, instead of ids[i].innerHTML = i). Or by ''hidden fields'', do you not mean <input type=''hidden''... >? Greg
oh right, value... god i always do that. but, its not even alerting ''hi'' so its not getting to that point even..... its making the list sortable, but nothing happens after i drag around.> Well, if they are hidden input fields, then I''m not sure you can use > innerHTML (all self-enclosed tags should have no innerHTML). You need > to set the value on them (ids[i].value = '''' + i, instead of > ids[i].innerHTML = i). Or by ''hidden fields'', do you not mean <input > type=''hidden''... >? > > Greg > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
Oh... if you use ''onUpdate'', then you must follow the rules for Sortable.serialize (i.e. each element has an id that matches the pattern \w+_\d+ (such as item_1, item_2, etc)). This is because onUpdate uses Sortable.serialize before and after the drag to see if the value changed. If you would rather not bother with all that, just do ''onChange'' instead, which is called every time the order changes during the dragging. I ran into this same thing not too long ago. Greg> -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org[mailto:rails-spinoffs-> bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Louis Walch > Sent: Monday, January 30, 2006 12:01 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: RE: [Rails-spinoffs] sortable list question > > oh right, value... god i always do that. > > but, its not even alerting ''hi'' so its not getting to that pointeven.....> > its making the list sortable, but nothing happens after i drag around. > > > > > Well, if they are hidden input fields, then I''m not sure you can use > > innerHTML (all self-enclosed tags should have no innerHTML). Youneed> > to set the value on them (ids[i].value = '''' + i, instead of > > ids[i].innerHTML = i). Or by ''hidden fields'', do you not mean<input> > type=''hidden''... >? > > > > Greg > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
thanks greg, i changed it to onChange... but its still not doing anythingggg!! AHHH... i even pared it down to only the alert, and nothing. the list IS draggable, so the JS is running. and i am doing it in firefox to watch for JS errors but nothing. here is my new code: <script type="text/javascript" language="javascript" charset="utf-8"> Sortable.create(''list_filmLnks'', { onChange: function() { alert(''hi''); } }); </script>> Oh... if you use ''onUpdate'', then you must follow the rules for > Sortable.serialize (i.e. each element has an id that matches the pattern > \w+_\d+ (such as item_1, item_2, etc)). This is because onUpdate uses > Sortable.serialize before and after the drag to see if the value > changed. If you would rather not bother with all that, just do > ''onChange'' instead, which is called every time the order changes during > the dragging. > > I ran into this same thing not too long ago. > > Greg > >> -----Original Message----- >> From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-spinoffs- >> bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Louis Walch >> Sent: Monday, January 30, 2006 12:01 PM >> To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> Subject: RE: [Rails-spinoffs] sortable list question >> >> oh right, value... god i always do that. >> >> but, its not even alerting ''hi'' so its not getting to that point > even..... >> >> its making the list sortable, but nothing happens after i drag around. >> >> >> >> > Well, if they are hidden input fields, then I''m not sure you can use >> > innerHTML (all self-enclosed tags should have no innerHTML). You > need >> > to set the value on them (ids[i].value = '''' + i, instead of >> > ids[i].innerHTML = i). Or by ''hidden fields'', do you not mean > <input >> > type=''hidden''... >? >> > >> > Greg >> > _______________________________________________ >> > Rails-spinoffs mailing list >> > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> > >> >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >