Autocomplete never submit value
Hello,
I'm playing with the Autocomplete widget in Lift 1.1 current SNAPTHOT version (generated on Sat Jun 20 06:47:53 PDT 2009) and I get the submitted value back in the Scala code, everything else works fine (autocomplete elements are shonw, etc). I'm quite new to lift, so perhaps I miss somthing obious.
I think that the problem is in the generated Javascript, when the selected value should be copied in the hidden field (line 131 of lift-widgets-1.1-SNAPSHOT-sources.jar!/net/liftweb/widgets/autocomplete/AutoComplete.scala, in "onLoad" value definition):
8<--------------
jQuery("#"""+id+"""").autocomplete(data, """+autocompleteOptions.toJsCmd+""").result(function(event, dt, formatted) {
jQuery("#"""+hidden+"""").val(dt.nonce);
8<--------------
The problem seems to be that dt has no "nonce" field, it's an array. If I modify the code as follow:
8<--------------
jQuery("#"""+id+"""").autocomplete(data, """+autocompleteOptions.toJsCmd+""").result(function(event, dt, formatted) {
jQuery("#"""+hidden+"""").val(formatted);
8<--------------
Everything works as expected.
Hope it may help ! Francois Armand
I'm playing with the Autocomplete widget in Lift 1.1 current SNAPTHOT version (generated on Sat Jun 20 06:47:53 PDT 2009) and I get the submitted value back in the Scala code, everything else works fine (autocomplete elements are shonw, etc). I'm quite new to lift, so perhaps I miss somthing obious.
I think that the problem is in the generated Javascript, when the selected value should be copied in the hidden field (line 131 of lift-widgets-1.1-SNAPSHOT-sources.jar!/net/liftweb/widgets/autocomplete/AutoComplete.scala, in "onLoad" value definition):
8<--------------
jQuery("#"""+id+"""").autocomplete(data, """+autocompleteOptions.toJsCmd+""").result(function(event, dt, formatted) {
jQuery("#"""+hidden+"""").val(dt.nonce);
8<--------------
The problem seems to be that dt has no "nonce" field, it's an array. If I modify the code as follow:
8<--------------
jQuery("#"""+id+"""").autocomplete(data, """+autocompleteOptions.toJsCmd+""").result(function(event, dt, formatted) {
jQuery("#"""+hidden+"""").val(formatted);
8<--------------
Everything works as expected.
Hope it may help ! Francois Armand
Leave a comment
on 2010-02-06 19:47 *
By github.importer
Imported from GitHub: http://github.com/dpp/liftweb/issues/27/find