The formatItem implementation is wrong. You are returning the
JavaScript object for the row (item) instead of a String to display.
Try "return item.Name".

Jörn

On Wed, Jul 16, 2008 at 1:28 AM, shapper <[EMAIL PROTECTED]> wrote:
>
> Sorry for the delay ...
>
> I just changed the file. Check it now.
>
>
> On Jul 15, 9:37 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]>
> wrote:
>> Firebug shows an error when I enter something. Can't debug it with the
>> compressed script - replace that with the uncompressed one and we may
>> get somewhere.
>>
>> Jörn
>>
>> On Tue, Jul 15, 2008 at 9:35 PM, shapper <[EMAIL PROTECTED]> wrote:
>>
>> > Hi,
>>
>> > Here it is:
>> >http://www.27lamps.com/Beta/AutoComplete/TagsUpdate.aspx
>>
>> > And I kept the previous one:
>> >http://www.27lamps.com/Beta/AutoComplete/Tags.aspx
>>
>> > Thank You,
>> > Miguel
>>
>> > On Jul 15, 6:09 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]>
>> > wrote:
>> >> Please put the commented code back in. The current one is rather useless.
>>
>> >> Jörn
>>
>> >> On Tue, Jul 15, 2008 at 4:31 PM, shapper <[EMAIL PROTECTED]> wrote:
>>
>> >> > Does anyone knows how to solve this problem?
>>
>> >> > Please, check my example in:
>> >> >http://www.27lamps.com/Beta/AutoComplete/Tags.aspx
>>
>> >> > On Jul 14, 9:57 pm, shapper <[EMAIL PROTECTED]> wrote:
>> >> >> Jörn,
>>
>> >> >> I just uploaded an ASP.NET application that shows exactly what the
>> >> >> problem was.
>> >> >> The commented script code is the one I used to try to solve my problem
>> >> >> but it does not work:
>>
>> >> >>http://www.27lamps.com/Beta/AutoComplete/Tags.aspx
>>
>> >> >> What should I do?
>>
>> >> >> Thanks,
>> >> >> Miguel
>>
>> >> >> On Jul 14, 6:02 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]>
>> >> >> wrote:
>>
>> >> >> > Learn to use Firebug - as I mentioned, the ajax request returns a 
>> >> >> > 404.
>> >> >> > It still does. Please come back when you have an actual JavaScript
>> >> >> > problem.
>>
>> >> >> > Jörn
>>
>> >> >> > On Mon, Jul 14, 2008 at 6:16 PM, shapper <[EMAIL PROTECTED]> wrote:
>>
>> >> >> > > Jörn,
>>
>> >> >> > > I just uploaded all your example to my server and the json example
>> >> >> > > does not work:
>> >> >> > >http://www.27lamps.com/Labs/AutoComplete/demo/json.html
>>
>> >> >> > > None of the remote works ... have no idea why.
>>
>> >> >> > > The same happens with my example:
>> >> >> > >http://www.27lamps.com/Labs/AutoComplete/demo/tags.html
>>
>> >> >> > > Anyway, all I am trying to make work is remote example where the 
>> >> >> > > JSON
>> >> >> > > returned is as follows:
>> >> >> > > [{"TagID":"017b253e-596b-4328-85f5-
>> >> >> > > fd97a783759c","Name":"Física","FileTags":[],"ProfessorTags":[]},
>> >> >> > > {"TagID":"3fae2160-55f6-4dd0-b856-
>> >> >> > > fd27f5d307e2","Name":"Matemática","FileTags":[],"ProfessorTags":[]},
>> >> >> > > {"TagID":"883b197e-0cb3-4528-8403-0877d742bf47","Name":"Matemática
>> >> >> > > B","FileTags":[],"ProfessorTags":[]},{"TagID":"f183cb9d-9d92-4c61-
>> >> >> > > b03a-
>> >> >> > > e51cc1205b2b","Name":"Português","FileTags":[],"ProfessorTags":[]}]
>>
>> >> >> > > I am not familiar with PHP but I created the following:
>> >> >> > > <?php
>> >> >> > > $q = strtolower($_GET["q"]);
>> >> >> > > if (!$q) return;
>>
>> >> >> > > echo "[";
>> >> >> > >  echo "{""TagID"":""017b253e-596b-4328-85f5-
>> >> >> > > fd97a783759c"",""Name"":""Física"",""FileTags"":[],""ProfessorTags"":
>> >> >> > > []},";
>> >> >> > >  echo "{""TagID"":""3fae2160-55f6-4dd0-b856-
>> >> >> > > fd27f5d307e2"",""Name"":""Matemática"",""FileTags"":
>> >> >> > > [],""ProfessorTags"":[]},";
>> >> >> > >  echo
>> >> >> > > "{""TagID"":""883b197e-0cb3-4528-8403-0877d742bf47"",""Name"":""Matemática
>> >> >> > > B"",""FileTags"":[],""ProfessorTags"":[]},";
>> >> >> > >  echo "{""TagID"":""f183cb9d-9d92-4c61-b03a-
>> >> >> > > e51cc1205b2b"",""Name"":""Português"",""FileTags"":
>> >> >> > > [],""ProfessorTags"":[]}]";
>> >> >> > > echo "]";
>>
>> >> >> > > And my AutoComplete code is as follows:
>> >> >> > > <script type="text/javascript">
>> >> >> > >    $(document).ready(function(){
>>
>> >> >> > >      $("#tag").autocomplete("tags.php", {
>> >> >> > >        autoFill: true,
>> >> >> > >        cacheLength: 1,
>> >> >> > >        multiple: true,
>> >> >> > >        scrollHeight: 200,
>> >> >> > >        selectFirst: false,
>> >> >> > >                width: 260,
>> >> >> > >        parse: function(data) {
>> >> >> > >                            return $.map(eval(data), function(row) {
>> >> >> > >                                    return {
>> >> >> > >                                            data: row,
>> >> >> > >                                            value: row.Name,
>> >> >> > >                                            result: row.Name
>> >> >> > >                                    }
>> >> >> > >                            });
>> >> >> > >                    },
>> >> >> > >                    formatItem: function(item) {
>> >> >> > >                            return item;
>> >> >> > >                    }
>> >> >> > >                  });
>>
>> >> >> > >    });
>> >> >> > > </script>
>>
>> >> >> > > This is what I have been using to try to find the problem in
>> >> >> > > AutoValidate so then I can fix the problem in my ASP.NET MVC 
>> >> >> > > project.
>>
>> >> >> > > Thanks,
>> >> >> > > Miguel
>>
>> >> >> > > On Jul 14, 4:40 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]>
>> >> >> > > wrote:
>> >> >> > >> Open firebug and look at the request being send. A 404 is 
>> >> >> > >> returned.
>>
>> >> >> > >> Jörn
>>
>> >> >> > >> On Mon, Jul 14, 2008 at 5:15 PM, shapper <[EMAIL PROTECTED]> 
>> >> >> > >> wrote:
>>
>> >> >> > >> > That was a mistake when I uploaded the files ... I sent two 
>> >> >> > >> > wrong
>> >> >> > >> > files.
>> >> >> > >> > I just updated the files:
>>
>> >> >> > >> >http://www.27lamps.com/Labs/AutoComplete/demo/tags.html
>>
>> >> >> > >> > Again it does not work.
>>
>> >> >> > >> > On Jul 14, 3:28 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]>
>> >> >> > >> > wrote:
>> >> >> > >> >> You forgot the document ready code.
>>
>> >> >> > >> >> Jörn
>>
>> >> >> > >> >> On Mon, Jul 14, 2008 at 4:07 PM, shapper <[EMAIL PROTECTED]> 
>> >> >> > >> >> wrote:
>>
>> >> >> > >> >> > Please, anyone?
>>
>> >> >> > >> >> > On Jul 14, 1:04 am, shapper <[EMAIL PROTECTED]> wrote:
>> >> >> > >> >> >> Hi,
>>
>> >> >> > >> >> >> I tried to replicate your code using the JSon string 
>> >> >> > >> >> >> generated by
>> >> >> > >> >> >> ASP.NET MVC.
>> >> >> > >> >> >> I created a static php code as you did ... To be honest I 
>> >> >> > >> >> >> am not
>> >> >> > >> >> >> familiar with php. This was the best I was able to do ...
>>
>> >> >> > >> >> >> I have been trying everything to make this work ... I 
>> >> >> > >> >> >> really don't
>> >> >> > >> >> >> understand why my AutoComplete does not work ...
>>
>> >> >> > >> >> >> Here is the page I 
>> >> >> > >> >> >> created:http://www.27lamps.com/Labs/AutoComplete/demo/tags.html
>>
>> >> >> > >> >> >> I cannot guarantee that PHP code is ok ... I am really not 
>> >> >> > >> >> >> used to it.
>>
>> >> >> > >> >> >> My ASP.NET MVC application generates the following JSon 
>> >> >> > >> >> >> string:
>>
>> >> >> > >> >> >> [{"TagID":"017b253e-596b-4328-85f5-
>> >> >> > >> >> >> fd97a783759c","Name":"Física","FileTags":[],"ProfessorTags":[]},
>> >> >> > >> >> >> {"TagID":"3fae2160-55f6-4dd0-b856-
>> >> >> > >> >> >> fd27f5d307e2","Name":"Matemática","FileTags":[],"ProfessorTags":[]},
>> >> >> > >> >> >> {"TagID":"883b197e-0cb3-4528-8403-0877d742bf47","Name":"Matemática
>> >> >> > >> >> >> B","FileTags":[],"ProfessorTags":[]},{"TagID":"f183cb9d-9d92-4c61-b03a-
>> >> >> > >> >> >> e51cc1205b2b","Name":"Português","FileTags":[],"ProfessorTags":[]}]
>>
>> >> >> > >> >> >> This was what I tried to replicate.
>>
>> >> >> > >> >> >> Does anyone has any idea how to solve my problem?
>>
>> >> >> > >> >> >> Thanks,
>> >> >> > >> >> >> Miguel
>>
>> >> >> > >> >> >> On Jul 13, 9:44 pm, shapper <[EMAIL PROTECTED]> wrote:
>>
>> >> >> > >> >> >> > Hi,
>>
>> >> >> > >> >> >> > With ASP.NET this is not so easy ...
>>
>> >> >> > >> >> >> > Anyway, I tried to place your example and mine in the 
>> >> >> > >> >> >> > same page using
>> >> >> > >> >> >> > PHP, which I am really not very 
>> >> >> > >> >> >> > familiar:http://www.27lamps.com/Labs/AutoComplete/AutoComplete.html
>>
>> >> >> > >> >> >> > Sorry, but I am not really use with PHP.
>>
>> >> >> > >> >> >> > Thanks,
>> >> >> > >> >> >> > Miguel
>>
>> >> >> > >> >> >> > On Jul 13, 2:41 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]>
>> >> >> > >> >> >> > wrote:
>>
>> >> >> > >> >> >> > > You still haven't posted a testpage. It doesn't have to 
>> >> >> > >> >> >> > > be dynamic, a
>> >> >> > >> >> >> > > static file that delivers the content that your 
>> >> >> > >> >> >> > > serverside usually
>> >> >> > >> >> >> > > works just as well.
>>
>> >> >> > >> >> >> > > Jörn
>>
>> >> >> > >> >> >> > > On Sun, Jul 13, 2008 at 2:45 PM, shapper <[EMAIL 
>> >> >> > >> >> >> > > PROTECTED]> wrote:
>>
>> >> >> > >> >> >> > > > Please, anyone?
>>
>> >> >> > >> >> >> > > > On Jul 12, 6:46 pm, shapper <[EMAIL PROTECTED]> wrote:
>> >> >> > >> >> >> > > >> Hi,
>>
>> >> >> > >> >> >> > > >> I can upload the client part but I am generating my 
>> >> >> > >> >> >> > > >> JSON using ASP.NET
>> >> >> > >> >> >> > > >> MVC and the project is not finish so I can't upload 
>> >> >> > >> >> >> > > >> it because it uses
>> >> >> > >> >> >> > > >> a SQL server.
>>
>> >> >> > >> >> >> > > >> Don't you have any idea what is going on?
>>
>> >> >> > >> >> >> > > >> I set up a page with this and I will try to explain 
>> >> >> > >> >> >> > > >> what I get. When I
>> >> >> > >> >> >> > > >> use:
>>
>> >> >> > >> >> >> > > >>       $("#Tags").autocomplete("/Professor/GetTags", {
>> >> >> > >> >> >> > > >>         autoFill: true,
>> >> >> > >> >> >> > > >>         selectFirst: false
>> >> >> > >> >> >> > > >>             });
>>
>> >> >> > >> >> >> > > >> My autocomplete shows but only one option in the 
>> >> >> > >> >> >> > > >> list ... however that
>> >> >> > >> >> >> > > >> option is including all the options returned by the 
>> >> >> > >> >> >> > > >> Json according to
>> >> >> > >> >> >> > > >> that criteria.
>> >> >> > >> >> >> > > >> For example, if I type "M" I get one option which 
>> >> >> > >> >> >> > > >> when selected puts
>> >> >> > >> >> >> > > >> the following in the input:
>>
>> >> >> > >> >> >> > > >> [{"TagID":"3fae2160-55f6-4dd0-b856-
>> >> >> > >> >> >> > > >> fd27f5d307e2","Name":"Matemática","FileTags":[],"ProfessorTags":[]},
>> >> >> > >> >> >> > > >> {"TagID":"883b197e-0cb3-4528-8403-0877d742bf47","Name":"Matemática
>> >> >> > >> >> >> > > >> B","FileTags":[],"ProfessorTags":[]}]
>>
>> >> >> > >> >> >> > > >> You see? It picks the two options.
>>
>> >> >> > >> >> >> > > >> I tried again and typed "F" and I get:
>> >> >> > >> >> >> > > >> [{"TagID":"017b253e-596b-4328-85f5-
>> >> >> > >> >> >> > > >> fd97a783759c","Name":"Física","FileTags":[],"ProfessorTags":[]}]
>>
>> >> >> > >> >> >> > > >> Which is also right because I have only that record.
>> >> >> > >> >> >> > > >> So the server code is receiving well the parameter 
>> >> >> > >> >> >> > > >> and returning the
>> >> >> > >> >> >> > > >> filtered records it but somehow the autocomplete 
>> >> >> > >> >> >> > > >> interprets that as
>>
>> ...
>>
>> read more »
>

Reply via email to