Flash Games

 FAQ   Search   Members   Groups   Register  User Control Panel      Login 

Your time now:
Mon Nov 23, 2009 8:33 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ]  Bookmark and Share
Author Message
 Post subject: Yahoo YUI autocomplete - JSON & "invalid label"
PostPosted: Thu Aug 21, 2008 8:20 am 
Offline

Joined: Thu Aug 21, 2008 7:59 am
Posts: 2
Hello:

I'm experiencing a problem with the following script using Yahoo's YUI 2.5.2:

Code:
  <div class="yui-skin-sam">
    <div id="myAutoComplete" style="margin-bottom:3em; width:25em;">
      <input id="keywords" type="text">
      <div id="autoCompleteContainer"></div>
    </div>

  <script type="text/javascript">
  <!--
    var dataSource = new YAHOO.widget.DS_ScriptNode("http://localhost:8080/?action=autocomplete", ["keywords", "keyword"]);
    var autoComplete = new YAHOO.widget.AutoComplete("keywords", "autoCompleteContainer", dataSource);
  //-->
  </script>

  </div>


The service that is called by the DS_ScriptNode widget is written in java and uses json-lib-2.2.2. It returns the following:

{"keywords":[{"keyword":"java"},{"keyword":"jboss"}]}

Upon typing in the inputfield, firebug shows me the following error:

invalid label

Naturally, I've searched the web for this error and it is due to the way the json-tree is evaluated by javascript. For it to function properly, the json-tree must be enclosed in paranthesis, like so:

({"keywords":[{"keyword":"java"},{"keyword":"jboss"}]})

However, it seems to me (as far as I have been able to determine som far), that all evaluations done by the YUI-library enclose the json-tree like that. So, does anyone have any ideas where I could look next?

All help will be much appreciated :)


Top
 Profile  
 
 Post subject: [SOLVED] Yahoo YUI autocomplete - JSON & "invalid l
PostPosted: Thu Aug 21, 2008 2:20 pm 
Offline

Joined: Thu Aug 21, 2008 7:59 am
Posts: 2
Hey:

I managed to solve this issue :) The service that returns the json must handle a "callback" parameter and wrap the json in it if it's present, i.e.

YAHOO.widget.DS_ScriptNode.callbacks[1]({"keywords":[{"keyword":"java"},{"keyword":"jboss"}]})

Hope this can be of help to others.


Top
 Profile  
 
 Post subject: Re: Yahoo YUI autocomplete - JSON & "invalid label"
PostPosted: Fri Oct 30, 2009 8:24 pm 
Offline

Joined: Fri Oct 30, 2009 8:22 pm
Posts: 1
Hi There,

I am using SOlr.

Please explain How did u solve this problem "invalid label"

Ankit


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group - Flash Games - TNX Invitation Code - TNX Review


Webmaster - Excruciating - Johnathan - Kotik - Ash - Tomi - rangana - Phate - dflynn - Medley