Drop down fields in custom forms

Hi all I did a quick search on this forum, but couldn't find any info.
Here is my question:



I am building custom form that will have a drop down select field, when user selects an option from the list next drop down should present limited number of choices.



Well known examples of this functionality is Car insurance forms Select Make-> then model and so on, anyway how do I do it in Matrix?

[quote]
I am building custom form that will have a drop down select field, when user selects an option from the list next drop down should present limited number of choices.



Well known examples of this functionality is Car insurance forms Select Make-> then model and so on, anyway how do I do it in Matrix?

[/quote]

There is no in-built logic or functionality to handle nested selections. It is likely that this would be an implementation using a customised form, performing the necessary logic in Javascript (or jQuery? :slight_smile: ) and handing off the results to custom-built selection lists with IDs matching those expected by a Matrix form submission.



Some implementers out there might have more technical information or a reference for inspiration.

I thought that might be the case, although I am not entirely clear how to submit the end result, also has anybody done a form where instead of asking people for address you can put a pin on the map and at submit time pass Long. and Lat. ?


Something like that http://its-buggered-mate.apps.lpmodules.com/

Hi EricD,


Since you've got the perfect example, a minor modification will do, which is to put the JS generated Long and Lat in a hidden metadata field in the asset builder.

With the custom form as it is at the moment you would need to put in additional javascript to get this to happen. If we used the example of the make and model we could put in some jquery to have it work. Out of context of the custom form you could do it like this:

    
    
    Ford
    Holden
    
    
    
    Laser
    Falcon
    Commodore
    Vectra
    


    
    $('#model').hide();
    $('#make').change(function() {
    var make = $('#make').val();
    $('#model').show();
    $('#model option').hide();
    $('#model option[value^=' + make + ']').show();
    });


That's completely untested, and as I said out of context of the custom form, but I think the idea behind it should work for you.

=== edit ===

I believe you can use the google maps api to query a lat and long, but without paying google limits the number of geocode requests you can send through by typing in an address.

Thanks everyone, this is something I am working on in free time, I will let you know what will come out of it. There are other ideas I am toying around with (populating that dropdown box from csv data source ), but as I am not that strong with JavaScript it is taking me longer to get things working.