- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2023 04:10 AM
Hi everyone, Im trying to set a value of a field "Confidentiality" depending on 3 radio buttons on a record producer, the buttons are:
"Public" -> Choices: "yes"
"Confidential" -> Choices: "yes"
"Restricted" -> Choices: "yes"
When I click one of the buttons it clears the value of the others, what Im trying to do is if the person chooses for exemple "Public", the field "Confidentiality" will be "Public" I've tried with this code:
function onSubmit() {
//Type appropriate comment here, and begin script below
var publicOption = g_form.getValue('public_option1');
var confidentialOption = g_form.getValue('confidential_option1');
var restrictedOption = g_form.getValue('restricted_option1');
var confidentialityField = 'u_confidentiality';
if (publicOption == 'sim') {
confidentialityField = 'public';
} else if (confidentialOption == 'sim') {
confidentialityField = 'confidential';
} else if (restrictedOption == 'sim') {
confidentialityField = 'highly_confidential';
}
}
But the the "Confidentiality" field always comes with the value "Public" does anybody knows why ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2023 08:05 AM
I changed the code to this and it worked
function onSubmit() {
//Type appropriate comment here, and begin script below
var publicOption = g_form.getValue('public_option1');
var confidentialOption = g_form.getValue('confidential_option1');
var restrictedOption = g_form.getValue('restricted_option1');
var confidentialityField = 'u_confidentiality';
if (publicOption == 'sim') {
g_form.setValue(confidentialityField, 'public');
} else if (confidentialOption == 'sim') {
g_form.setValue(confidentialityField, 'confidential');
} else if (restrictedOption == 'sim') {
g_form.setValue(confidentialityField, 'highly_confidential');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2023 04:29 AM
Hi @F_bio Santos ,
Can you alert the values of publicOption,confidentialOption,restrictedOption and see what values are returned after submission.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2023 05:57 AM
Hi @Manisha Reddy K just checked and they are all coming as "false" even the one I choose
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2023 08:05 AM
I changed the code to this and it worked
function onSubmit() {
//Type appropriate comment here, and begin script below
var publicOption = g_form.getValue('public_option1');
var confidentialOption = g_form.getValue('confidential_option1');
var restrictedOption = g_form.getValue('restricted_option1');
var confidentialityField = 'u_confidentiality';
if (publicOption == 'sim') {
g_form.setValue(confidentialityField, 'public');
} else if (confidentialOption == 'sim') {
g_form.setValue(confidentialityField, 'confidential');
} else if (restrictedOption == 'sim') {
g_form.setValue(confidentialityField, 'highly_confidential');
}
}