So, I have one domain class and it has many fields.I have five drop-downs in GSP ready and the data is getting filtered on the onChange of any of the drop-downs properly but there is an issue. For a few set of combinations selected in the drop-downs, we don't have data in the database and these combinations are not fixed.
So, I was thinking is it possible that once a selection is made on the first drop-down(or on any of the drop-downs) the rest of the drop-downs take up values depending on the first selection(meaning the other drop-downs be populated with only those values for which data is available in the database) and this should follow for the subsequent selections too.
Also, I have seen examples of dependent drop-downs but all the examples that I see have multiple drop-downs but each of these drop-downs get values from different domain classes
Is it even possible to do this with just one domain class?
This is how my index.gsp looks like:
<html>
<head>
<g:javascript src="jquery-1.10.2.js"/>
<g:javascript src="prototype.js"/>
</head>
<body>
<form>
<g:select from="['DESKTOP/LAPTOP','SMARTPHONES','OTHERS','TABLETS']" name="device" id ="device"
onchange="${remoteFunction(
controller:'Pgtyp',
action:'ajaxGetMv',
// params:'\'mv=\' + escape(this.value)',
params:'\'device=\'+this.value+\'&mv=\'+$(\'mv\').value+\'&browser=\'+$(\'browser\').value+\'&pagetype=\'+$(\'pagetype\').value+\'&platform=\'+$(\'platform\').value' ,
onSuccess: 'printpgtyp(data)')}"
></g:select>
<g:select from="['CORESITE','MWEB']" name="platform" id ="platform"
onchange="${remoteFunction(
controller:'Pgtyp',
action:'ajaxGetMv',
// params:'\'mv=\' + escape(this.value)',
params:'\'platform=\'+this.value+\'&mv=\'+$(\'mv\').value+\'&browser=\'+$(\'browser\').value+\'&pagetype=\'+$(\'pagetype\').value' ,
onSuccess: 'printpgtyp(data)')}"
></g:select>
<g:select from="['CHECKOUT','HOMEPAGE','OTHERS', 'DEPARTMENT', 'PRODUCT','SEARCH', '(All)','SHELF']" name="pagetype" id ="pagetype"
onchange="${remoteFunction(
controller:'Pgtyp',
action:'ajaxGetMv',
// params:'\'mv=\' + escape(this.value)',
params:'\'pagetype=\'+this.value+\'&mv=\'+$(\'mv\').value+\'&browser=\'+$(\'browser\').value+\'&platform=\'+$(\'platform\').value' ,
onSuccess: 'printpgtyp(data)')}"
></g:select>
<g:select from="['INTERNET EXPLORER','GOGGLE CHROME','SAFARI', 'MOZILLA', 'OTHERS']" name="browser" id ="browser"
onchange="${remoteFunction(
controller:'Pgtyp',
action:'ajaxGetMv',
// params:'\'mv=\' + escape(this.value)',
params:'\'browser=\'+this.value+\'&mv=\'+$(\'mv\').value+\'&pagetype=\'+$(\'pagetype\').value+\'&platform=\'+$(\'platform\').value' ,
onSuccess: 'printpgtyp(data)')}"
></g:select>
<g:select from="['AFFILIATES', 'CSE','DISPLAYADS','EMAIL','MOBILEWEB','OTHERS','ORGANIC','SEO', 'SEM']" name="mv" id = "mv"
onchange="${remoteFunction(
controller:'Pgtyp',
action:'ajaxGetMv',
// params:'\'mv=\' + escape(this.value)',
params:'\'mv=\'+this.value+\'&browser=\'+$(\'browser\').value+\'&pagetype=\'+$(\'pagetype\').value+\'&platform=\'+$(\'platform\').value' ,
onSuccess: 'printpgtyp(data)')}"
></g:select>
</form>
<script>
function printpgtyp(data)
{
console.log(data)
}
</script>
</body>
</html>