[Lift] Re: Firefox issue with ajaxSelectObj and page refresh
On Tue, Oct 27, 2009 at 4:02 PM, Jeppe Nejsum Madsen wrote: > > On Tue, Oct 27, 2009 at 10:59 PM, Jeppe Nejsum Madsen > wrote: > > David Pollak writes: > > > >> What's the JavaScript to force the correct item to be selected? I think > we > >> could append the JavaScript to the ajaxSelectObj to force the right > thing to > >> happen. > > > > For jQuery, something like $("#dropdown").val(2); should work. But the > > issue is that it should (ideally) only be done whenever the page is > > refreshed, not on initial load where everything works. Dunno if hurts to > > always force the selection. > > > > /Jeppe > > I tried to see if I could hack a POC for this, but I failed to see how > I can get the id's of the options that are generated by ajaxSelect. > This makes it hard to manipulate client side :-) > If you can write the JavaScript for a "normal" select (one where you know the values), I can do the rest. I'm thinking that we have a script that comes with the itself that, on load, sets the select to the right value. > > /Jeppe > > > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Firefox issue with ajaxSelectObj and page refresh
On Tue, Oct 27, 2009 at 10:59 PM, Jeppe Nejsum Madsen wrote: > David Pollak writes: > >> What's the JavaScript to force the correct item to be selected? I think we >> could append the JavaScript to the ajaxSelectObj to force the right thing to >> happen. > > For jQuery, something like $("#dropdown").val(2); should work. But the > issue is that it should (ideally) only be done whenever the page is > refreshed, not on initial load where everything works. Dunno if hurts to > always force the selection. > > /Jeppe I tried to see if I could hack a POC for this, but I failed to see how I can get the id's of the options that are generated by ajaxSelect. This makes it hard to manipulate client side :-) /Jeppe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Firefox issue with ajaxSelectObj and page refresh
David Pollak writes: > What's the JavaScript to force the correct item to be selected? I think we > could append the JavaScript to the ajaxSelectObj to force the right thing to > happen. For jQuery, something like $("#dropdown").val(2); should work. But the issue is that it should (ideally) only be done whenever the page is refreshed, not on initial load where everything works. Dunno if hurts to always force the selection. /Jeppe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Firefox issue with ajaxSelectObj and page refresh
What's the JavaScript to force the correct item to be selected? I think we could append the JavaScript to the ajaxSelectObj to force the right thing to happen. On Mon, Oct 26, 2009 at 4:27 PM, Jeppe Nejsum Madsen wrote: > > Hi, > > When using ajaxSelectObj and I have the currently selected object in a > SessionVar and refreshes the page, the selected object is not selected > in the browser after the page refresh, even if the generated html has > the correct selected="selected" option. > > This only happens on Firefox (OS X), not Chrome or Safari and seems to > be a known FF issue (eg > http://www.beyondcoding.com/2008/12/16/option-selectedselected-not-working/ > ) > > but I was wondering if there's some well known Lift workaround? The > obvious problem is of course that the view is now out of sync with the > server > > /Jeppe > > The basic lift app with the following template & snippet: > > > > My select > > > > class HelloWorld { > val lcs = List(1,2,3) > private object lc1 extends SessionVar[Box[Int]](Empty) > > def select(in: NodeSeq): NodeSeq = { >println("lc1 is: "+lc1.is) >bind("select", in, "lc1" ->ajaxSelectObj(lcs.map(lc => (lc, "Item > "+lc.toString)), lc1.is, >(lc:Int) => { > lc1(Full(lc)) > println("selected lc1=%s".format(lc1)); > SetHtml("mylc", Text(lc.toString)) >})) > } > } > > > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---