[ic] Improving my search form

Marty Tennison marty at dripdepot.com
Mon Feb 8 16:36:53 UTC 2010


DB wrote:
>> [snip]
>
> Thanks - that looks pretty slick and I see that many other plugins
> exist. Can you provide any hints/examples about how to pass info back
> and forth between the plugin and IC?
>
> DB
>
>   

In its simplest form..... (not tested, most certainly has bugs)


1) Include jquery and the double select plugin in the html head

<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/js/jquery.doubleselect.js"></script>

2) Create the options array from ITL [query] statements


[query
    type=list
    prefix=brand
    sql=|
        SELECT  distinct brand
        FROM    brandmodel
        ORDER BY brand
        |]
[list]

[tmp ds_options][scratch ds_options]
    "[brand-code]": {
        "key" : [brand-increment],
        "defaultvalue" : "",
        "values" : {
            [query
                type=list
                prefix=model
                sql=|
                    SELECT  distinct brand
                    FROM    brandmodel
                    WHERE brand = [brand-code]
                    ORDER BY model
                    |]
            [list]
            "[model-code]": [model-code],
            [/list]
            [/query]
                }
        },
[/tmp]

[/list]
[/query]




3) Include the form somewhere in the page
<form>
    <select id="brand" name="brand" size="1"><option 
value="">--</option></select>
    <select id="model" name="model" size="1"><option 
value="">--</option></select>
</form>



4) Include the javascript somewhere in the page

<script type="text/javascript">
$(document).ready(function() {
    [scratchd ds_options]
    };
    $('#brand').doubleSelect('model', selectoptions);     
 });
</script>

You may need to pull out a numeric rowid or similar for the option value 
if it will not take an alphanumeric value.

Hope that helps. 

-- 
-  - -- ----  ---------------------------- --- -- -   -
Marty Tennison                     DripDepot.com
email: marty at dripdepot.com
web: www.dripdepot.com
-  -- --- --------------------------------------- --- --




More information about the interchange-users mailing list