I was wondering whether it would be possible to fill in a parameter using Javascript in a Single and Multiple choice field. I'm able to fill in other types of field, but not these types.
I've tried your solution and I noticed something weird happend. The field is set correctly but it's not showing.
For example:
When I add this to the url:
https://[URL]/?Onderzoek=Intelligentieonderzoek
While using this code:
fd.field('WelkTypeOnderzoekWiltUAanvragen').value = [urlParams.get('Onderzoek')];
console.log("Value of field 'WelkTypeOnderzoekWiltUAanvragen' is: " + fd.field('WelkTypeOnderzoekWiltUAanvragen').value);
The logging shows me that the value is set correctly:
But it's not shown in the form itself (the box is not checked):
I have double checked the name of the field, it's correct.
The weird thing is, when I try this code using the in-browser console, it works, but when I try this code with Plumsail the checkbox still isn't checked:
Full code:
window.fd = fd;
window.$ = $;
fd.rendered(() => {
var queryString = window.location.search;
var urlParams = new URLSearchParams(queryString);
let optns = [];
optns.push(urlParams.get('Onderzoek'));
fd.field('WelkTypeOnderzoekWiltUAanvragen').value = optns;
}
Field name: WelkTypeOnderzoekWiltUAanvragen
Field type: Multiple choice
Any ideas? I really appreciate your help. Thank you!