fmwebschool.com
Top Experts [learn more]Top 4-10
webko

9743 K
bandmandq

2458 K
Genx

1525 K
4. tcmeyers
5. kbata
6. Martie
7. Hammerton
8. rrenfrow
9. bneeman
10. plegler
Welcome, Guest. Please login or register.
June 18, 2013, 01:56:20 PM

Login with username, password and session length
Search:     Advanced search
FMWebschool releases more educational FMStudio webinars - check them out here:
http://www.fmwebschool.com/webinars.php
27507 Posts in 6073 Topics by 1524 Members
Latest Member: fmwebster
* Home Help Search Calendar Login Register
+  fmwebschool.com
|-+  FMStudio
| |-+  FMStudio Pro
| | |-+  Auto suggestion list based on filemaker tables
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Auto suggestion list based on filemaker tables  (Read 582 times)
acculogic
Newbie
*
Offline Offline

Posts: 14


WWW
« on: March 20, 2012, 11:25:01 AM »

Hi guys,

Some websites like the one mostly in air booking industry have auto suggestion feature when entering in the cities.
Has anyone attempted to do this with live fields? is it possible?

Thanks
Logged

Acculogic Technologies
webko
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2060
Kudos: 9743



WWW
Applications:
« Reply #1 on: March 20, 2012, 02:41:26 PM »

With live fields? No idea...

With some custom code? Absolutely...

Basic technique is to do a pre-find for the page to generate an array of the possible values, then use some JavaScript to parse that on the fly as people type
Logged

tim.webko_at_gmail.com
acculogic
Newbie
*
Offline Offline

Posts: 14


WWW
« Reply #2 on: March 20, 2012, 06:06:35 PM »

How hard do you think this is to do? Never really tried AJAX before  Huh

Maybe this is out of my scope....
Logged

Acculogic Technologies
webko
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2060
Kudos: 9743



WWW
Applications:
« Reply #3 on: March 22, 2012, 03:57:13 PM »

You could do this with AJAX to check on the fly, but you don't need to. You need a JavaScript function, and a search to get the list you want...

The attached file is actually a html file (called actb.txt due to upload restrictions) - take it, rename it, and load it to a webserver. It will autocomplete based on the array defined at Line 654:

Code:
<script>
var customarray=new Array('an apple','alligator','elephant','pear','kingbird','kingbolt', 'kingcraft','kingcup','kingdom','kingfisher','kingpin');
</script>

For our purposes we want to use a find to FileMaker. I use FX but the idea is to get an array back. Pseudo-code:

Code:
<?php
//Do a find and then a foreach
$actb_list "";
foreach(
$findData['data'] as $key=>$value) {
   
$actb_list "'".$value['field'][0]."',";
}
?>


<script>
var customarray=new Array(<?php echo $actb_list?>);
</script>

Now the JS array should be populated with the data from the find and be able to be auto-completed...

* actb.txt (18.01 KB - downloaded 92 times.)
Logged

tim.webko_at_gmail.com
acculogic
Newbie
*
Offline Offline

Posts: 14


WWW
« Reply #4 on: April 03, 2012, 07:52:19 PM »

Hi Webko,

Your solutions works perfectly. Used FMStudio to do the heavy lifting too.
Another questions how would I then have a hidden field for the id of the record to be submitted to the name....

Thanks.
Logged

Acculogic Technologies
webko
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2060
Kudos: 9743



WWW
Applications:
« Reply #5 on: April 04, 2012, 03:11:01 PM »

That particular technique will only pass the one value - the name selected.

You'd need to use a dropdown rather than a textbox in order to show the name, but pass an ID. I don't have the time right now to do research on that though...
Logged

tim.webko_at_gmail.com
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!