Welcome Guest, Not a member yet? Register   Sign In
jQuery AJAX autocomplete with CodeIgniter
#11

[eluser]NachoF[/eluser]
I have tried your version and the original version and I dont know why but for some reason in your version after I select an element from the autocomplete and then I press tab it wont go to the next form element.. the original version does. Sad any ideas??
#12

[eluser]naren_nag[/eluser]
[quote author="NachoF" date="1241341707"]I have tried your version and the original version and I dont know why but for some reason in your version after I select an element from the autocomplete and then I press tab it wont go to the next form element.. the original version does. Sad any ideas??[/quote]

Wow. I've never come across this ... and the tab works for me. Would you care to share some snippets of code?
#13

[eluser]NachoF[/eluser]
Its not that big of a deal... Im having trouble accomplishing this though...Let me give you an example... my filter will be an input text field called PIN... thats where you start typing a a number... I want the autocomplete to show me the results and next to them the names of the clients.. when I select one I want it to autocomplete the pin input, the name input and every input... all of the data is stored in a mysql table... so basically everything related to the clients has to be returned after the ajax request, but Im not sure how to get this done...please help me with a tiny example like this

you have three elements:
pin
name
address
when you start tyiping in pin the dropdown will show you
PIN/Name of the client related
and when you select one everything will get filled.

Please help... I dont know what my function should echo and what my script should request Sad
#14

[eluser]naren_nag[/eluser]
[quote author="NachoF" date="1241380860"]Its not that big of a deal... Im having trouble accomplishing this though...Let me give you an example... my filter will be an input text field called PIN... thats where you start typing a a number... I want the autocomplete to show me the results and next to them the names of the clients.. when I select one I want it to autocomplete the pin input, the name input and every input... all of the data is stored in a mysql table... so basically everything related to the clients has to be returned after the ajax request, but Im not sure how to get this done...please help me with a tiny example like this

you have three elements:
pin
name
address
when you start tyiping in pin the dropdown will show you
PIN/Name of the client related
and when you select one everything will get filled.

Please help... I dont know what my function should echo and what my script should request Sad[/quote]

So here's what you do:

The autocomplete script calls a script that echos two things - a string and an id, the string should be the pin : name ...

When you select a particular pin : name combination, a second ajax script is called that figures out the name and address of a person based on the selection and returns it as a json encoded array.

Does that make sense, or would you like me to post code snippets?

Nag
#15

[eluser]NachoF[/eluser]
[quote author="naren_nag" date="1241425424"][quote author="NachoF" date="1241380860"]Its not that big of a deal... Im having trouble accomplishing this though...Let me give you an example... my filter will be an input text field called PIN... thats where you start typing a a number... I want the autocomplete to show me the results and next to them the names of the clients.. when I select one I want it to autocomplete the pin input, the name input and every input... all of the data is stored in a mysql table... so basically everything related to the clients has to be returned after the ajax request, but Im not sure how to get this done...please help me with a tiny example like this

you have three elements:
pin
name
address
when you start tyiping in pin the dropdown will show you
PIN/Name of the client related
and when you select one everything will get filled.

Please help... I dont know what my function should echo and what my script should request Sad[/quote]

So here's what you do:

The autocomplete script calls a script that echos two things - a string and an id, the string should be the pin : name ...

When you select a particular pin : name combination, a second ajax script is called that figures out the name and address of a person based on the selection and returns it as a json encoded array.

Does that make sense, or would you like me to post code snippets?

Nag[/quote]

The thing is, if the first request echoes more than just the PIN, when I select it it will then put more than just the PIN in the text box... I want the dropdown to show me the pin and the name but after I select one the pin textbox should only have the selected pin
#16

[eluser]naren_nag[/eluser]
[quote author="NachoF" date="1241426090"][quote author="naren_nag" date="1241425424"][quote author="NachoF" date="1241380860"]Its not that big of a deal... Im having trouble accomplishing this though...Let me give you an example... my filter will be an input text field called PIN... thats where you start typing a a number... I want the autocomplete to show me the results and next to them the names of the clients.. when I select one I want it to autocomplete the pin input, the name input and every input... all of the data is stored in a mysql table... so basically everything related to the clients has to be returned after the ajax request, but Im not sure how to get this done...please help me with a tiny example like this

you have three elements:
pin
name
address
when you start tyiping in pin the dropdown will show you
PIN/Name of the client related
and when you select one everything will get filled.

Please help... I dont know what my function should echo and what my script should request Sad[/quote]

So here's what you do:

The autocomplete script calls a script that echos two things - a string and an id, the string should be the pin : name ...

When you select a particular pin : name combination, a second ajax script is called that figures out the name and address of a person based on the selection and returns it as a json encoded array.

Does that make sense, or would you like me to post code snippets?

Nag[/quote]

The thing is, if the first request echoes more than just the PIN, when I select it it will then put more than just the PIN in the text box... I want the dropdown to show me the pin and the name but after I select one the pin textbox should only have the selected pin[/quote]

In the ajax script do this

echo $pin . " : " . $name | $pin;

This is the jquery function I use to replace values (I reference this is in the autocomplete declaration) :

Code:
function selectItem(li, elementID) {
            $("#"+elementID).val(0);
            var setVal = (li.extra) ? li.extra[0] : 0;
            $("#"+elementID).val(setVal);
        }

Head over to www.narendranag.com for a better explanation, I have a post there on this
#17

[eluser]Unknown[/eluser]
Cheers guys, great help
#18

[eluser]rwzhao[/eluser]
Have you tried in IE? It is not working in IE I have tested.

Any idea?
#19

[eluser]naren_nag[/eluser]
[quote author="rwzhao" date="1242207541"]Have you tried in IE? It is not working in IE I have tested.

Any idea?[/quote]


Which version of IE are you testing in?
#20

[eluser]yrachmanu[/eluser]
@narren : sorry for slow respon either. Smile , my last problem it solved now,
but just like you said before it's work all browser except IE




Theme © iAndrew 2016 - Forum software by © MyBB