09-19-2011, 06:45 PM
|
#2 (permalink)
|
|
The Acquainted
Join Date: Nov 2007
Posts: 166
Thanks: 0
|
Setup an onchange event on the first checkbox. Use AJAX to load the values for the second checkbox depending on the value of the first checkbox. Populate the second checkbox with the data returned from AJAX.
jQuery would make it really easy to do. Here is something to get you started. I have not tested the code.
javascript Code:
$('#checkbox1').change(function() { var value = $(this).val(), checkbox2 = $('#checkbox2'), params = {}; // make checkbox 2 show that it is loading and disable it checkbox2.html('<option>Loading...</option>').attr('disabled', true); // set values for ajax call switch (value) { case 'one': params.foo = 'one'; break; case 'two': params.foo = 'two'; break; } // make ajax call $.post('path/to/script', params, function(data) { // set checkbox2 values and enable checkbox2.html(data).attr('disabled', false); }); });
__________________
Eric
|
|
|
|