Hi to all the forums,
and thanks for your great works and support..Here I found many useful posts that helped me to make my own form, but now i need your help...(sorry for my english, i'm using google translate 😀 )
I'm trying to autopopulate a text box field (City) with the Autocomplete Loader/Processor plugins...everything works fine, but I wish the data were loaded in order by Importance/Alphabetical.
This is what happens now:
If I type "Roma" (Italian Capital), the plugin suggests many other small towns that have inside the word "Roma"

Same things happens if I type "Napoli"..as you can see Napoli is the last one, but i wish it was the first...

How can I solve this problem??
I have attached a sample form and the sql file with all the Italian towns
Thanks in advance
and thanks for your great works and support..Here I found many useful posts that helped me to make my own form, but now i need your help...(sorry for my english, i'm using google translate 😀 )
I'm trying to autopopulate a text box field (City) with the Autocomplete Loader/Processor plugins...everything works fine, but I wish the data were loaded in order by Importance/Alphabetical.
This is what happens now:
If I type "Roma" (Italian Capital), the plugin suggests many other small towns that have inside the word "Roma"

Same things happens if I type "Napoli"..as you can see Napoli is the last one, but i wish it was the first...

How can I solve this problem??
I have attached a sample form and the sql file with all the Italian towns
Thanks in advance
Hi fasenderos ,
There is no easy way to do this. Neither ChronoForms nor Joomla! know which cities are important so you'd need to find some way to add that information and link it to the sutoselect.
Bob
There is no easy way to do this. Neither ChronoForms nor Joomla! know which cities are important so you'd need to find some way to add that information and link it to the sutoselect.
Bob
Hi GreyHead,
thanks for reply... I understand that it isn't easy to do that...so leave out the "Importance parameter"...
but what about the Alphabetical Order? for e.g. if I Type "R", i wish to obtain an alphabetical ordered list of towns that BEGIN with the letter R..., then if i type the letter "O", the list should include ONLY cities whose names begins with the letter RO....
NOT ALL the cities that contain inside the letters "r" and "o"
I hope that i am clear 😶
thanks for reply... I understand that it isn't easy to do that...so leave out the "Importance parameter"...
but what about the Alphabetical Order? for e.g. if I Type "R", i wish to obtain an alphabetical ordered list of towns that BEGIN with the letter R..., then if i type the letter "O", the list should include ONLY cities whose names begins with the letter RO....
NOT ALL the cities that contain inside the letters "r" and "o"
I hope that i am clear 😶
Hi fasenderos,
In the AutoComplete Processor action there's a Code box that you can use to over-ride the automatic results. Check the Help tab there for a bit more information.
The results you are getting now are in the array $form->data['_PLUGINS_']['autocomplete_processor']['result'] so we can alter them. This code will check if the search string is at the beginning of a result and drop the reault if it isn't. It will also sort the final array; and show a message if there are no results.
Bob
Bob
In the AutoComplete Processor action there's a Code box that you can use to over-ride the automatic results. Check the Help tab there for a bit more information.
The results you are getting now are in the array $form->data['_PLUGINS_']['autocomplete_processor']['result'] so we can alter them. This code will check if the search string is at the beginning of a result and drop the reault if it isn't. It will also sort the final array; and show a message if there are no results.
<?php
$result =& $form->data['_PLUGINS_']['autocomplete_processor']['result'];
if ( count( $result ) ) {
foreach ( $result as $k => $v ) {
if ( strpos( $v, $search ) > 0 ) {
unset( $result[$k] );
}
}
}
if ( count( $result ) ) {
sort( $result );
} else {
$result = array('No matches found');
}
?>
NB the search key is available here as $search.Bob
Bob
Hi GreyHead,
I tried using your code, but there is some problem...here are some examples:
FIRST:

SECOND:

what's wrong?
Thanks
I tried using your code, but there is some problem...here are some examples:
FIRST:

SECOND:

what's wrong?
Thanks
Hi fasenderos,
Please make sure that the Caching option is turned off in the AutoProcessor Loader action.
Please post a link to the form so I can take a quick look.
Bob
Please make sure that the Caching option is turned off in the AutoProcessor Loader action.
Please post a link to the form so I can take a quick look.
Bob
Hi GrayHead
The Caching option is now turned off, but the problem still remains the same.
I can't post a link because the site is in localhost...However, in the first post I have attached the form...If you have successfully changed the form, can you attach a backup?
Thanks
The Caching option is now turned off, but the problem still remains the same.
I can't post a link because the site is in localhost...However, in the first post I have attached the form...If you have successfully changed the form, can you attach a backup?
Thanks
Hi fasenderos,
I tested with an existing form because that's quick and simple. I'll install your MySQL table and take a look at your form.
Bob
I tested with an existing form because that's quick and simple. I'll install your MySQL table and take a look at your form.
Bob
Hi fasenderos,
The main problem I found was that the data I tested with wasn't case sensitive and yours is. You also need to set the Max Choice box in the AutoComplete Processor pretty high - around 100 seemed OK otherwise there is a good chance that all of the results will be deleted by the filter.
Bob
The main problem I found was that the data I tested with wasn't case sensitive and yours is. You also need to set the Max Choice box in the AutoComplete Processor pretty high - around 100 seemed OK otherwise there is a good chance that all of the results will be deleted by the filter.
<?php
$result =& $form->data['_PLUGINS_']['autocomplete_processor']['result'];
if ( count( $result ) ) {
foreach ( $result as $k => $v ) {
if ( stripos( $v, $search ) > 0 ) {
unset( $result[$k] );
}
}
}
if ( count( $result ) ) {
sort( $result );
} else {
$result = array('No matches found');
}
?>
Bob
Hi bob,
you are a genius...your code works like a charm...
thanks so much
you are a genius...your code works like a charm...
thanks so much
Hi, sorry for my English, I'm not English.
I want to have an autocomplete text box with a list consists of two db columns:
Column A
name: "comune", data example: "Milano"
Column B
name: "sigla", data example: "MI"
This columns must be combined in this way:
comune (sigla)
Which PHP code can I use to accomplish this?
Thanks
Carlo
I want to have an autocomplete text box with a list consists of two db columns:
Column A
name: "comune", data example: "Milano"
Column B
name: "sigla", data example: "MI"
This columns must be combined in this way:
comune (sigla)
Which PHP code can I use to accomplish this?
Thanks
Carlo
This topic is locked and no more replies can be posted.