Struggling with manipulating checkbox values? The `change` event on checkboxes might return an object like this:
{"val1":"member","val2":"book","val3":"journal","val4":"new_member","val5":"cds"}
To transform the above object into a format that can be consumed by a search engine, you can follow this approach:
{ member, book, journal, new_member, cds}
If you want to reuse the output of the `change` event in your code, consider storing it in a variable. Here's a sample code snippet that demonstrates how to achieve this:
var formcheckbox = this.getFormcheckbox();
formcheckbox.on('change', function(checkbox, value){
var arr=[];
for (var i in value) {
arr.push(value[i])
};
var wrd = new Array(arr);
var joinwrd = wrd.join(",");
var filter = '{' + joinwrd + '}';
// Storing the output for later use
var output = filter;
// You can now use the 'output' variable elsewhere
//console.log(filter);
//Ext.Msg.alert('Output', '{' + joinwrd + '}');
});
If you face any issues while implementing this, don't hesitate to ask for help. We were all beginners once! Good luck!
Best regards,
Tom