AutoComplete does not put value into var

24 views
Skip to first unread message

Maciej Bąk

unread,
Nov 6, 2012, 9:38:16 AM11/6/12
to lif...@googlegroups.com
Hello,

I have code like this:

////////////
private val data = deleg.findAll.map(_.gdzie.is)

def buildNames(current: String, limit: Int): Seq[String] = {
      data.filter(_.matches(".*" + current + ".*"))
    }
  
  def buttonClick = "#submit [onclick]" #> SHtml.ajaxInvoke( () => process )
  def render = {
    "id=kto" #> SHtml.select(users, Empty, id => kto = id) &
    "id=data_od" #> SHtml.text(data_od, data_od = _) &
    "id=data_do" #> SHtml.text(data_do, data_do = _) &
    "id=dzien_wczesniej" #> SHtml.checkbox(dzien_wczesniej, dzien_wczesniej = _) &
    "id=gdzie" #> (AutoComplete("", buildNames _, gdzie = _))
  }
////////////

AutoComplete shows list of results fine but when i choose some value from the list, as a value of "gdzie" I have null..
Any ideas ?
Thanks

Diego Medina

unread,
Nov 7, 2012, 12:05:55 AM11/7/12
to Lift
I think you need to submit your form to get the Autocomplete to assign
the value, but I see you have that one SHTml.ajaxInvoke in there

Maybe you can put together a sample app
https://www.assembla.com/wiki/show/liftweb/Posting_example_code
and we can better help you.

Diego
> --
> --
> Lift, the simply functional web framework: http://liftweb.net
> Code: http://github.com/lift
> Discussion: http://groups.google.com/group/liftweb
> Stuck? Help us help you:
> https://www.assembla.com/wiki/show/liftweb/Posting_example_code
>
>
>



--
Diego Medina
Lift/Scala Developer
di...@fmpwizard.com
http://www.fmpwizard.com

Maciej Bąk

unread,
Nov 7, 2012, 2:36:58 AM11/7/12
to lif...@googlegroups.com
here is wpr_del.scala: http://pastebin.com/ec4UMiN8
here wpr_del.html: http://pastebin.com/XJuUPMqV

Maciej Bąk

unread,
Nov 7, 2012, 2:38:41 AM11/7/12
to lif...@googlegroups.com
And in def process()

to database value of "gdzie" is null, if I made println("test"+gdzie) as a result i have only test..

Maciej Bąk

unread,
Nov 7, 2012, 3:36:43 AM11/7/12
to lif...@googlegroups.com
Hmmm i make some test and when i change:
private val data = deleg.findAll.map(_.gdzie.is)
to
private val data = List("Warsaw", "Londyn", "Test", "XZX")

It works fine..
So problem is with data val.
But even If I do: private val data = deleg.findAll.map(_.gdzie.is).toList  (toList) it doesnt work..

Maciej Bąk

unread,
Nov 7, 2012, 3:55:48 AM11/7/12
to lif...@googlegroups.com
Ah problem is elsewhere..

Problem is when i put value which is new, then it wont remember value into var..
Anyone know solution for it ?
Thanks

Jonas Vautherin

unread,
Nov 7, 2012, 6:09:00 AM11/7/12
to lif...@googlegroups.com
Which version of AutoComplete do you use? I had to use this one:

https://github.com/MrMistr/autocomplete

Hope it helps,
Jonas


--

Maciej Bąk

unread,
Nov 7, 2012, 6:44:00 AM11/7/12
to lif...@googlegroups.com
I dled this file from site, and works fine :))
Thanks!
Reply all
Reply to author
Forward
0 new messages