Hi there,
I'm new to Plumsail and need to create a form in which texts pop up, if a toggle is used.
I tried the JavaScript multiple times but no matter what kind of code I add in the JavaScript editor, my form doesn't change.
How do I get my forms to execute the code I implemented?
I used the following code from the documentation:
fd.spRendered(function() {
function hideOrShowField() {
if (fd.field('Nachlass').value) {
// Show the MyField field
fd.field('Preisnachlassunterlagen').hidden = false;
} else {
// Hide the MyField field
fd.field('Preisnachlassunterlagen').hidden = true;
}
}
// Calling hideOrShowField when the YesNo value changes
fd.field('Nachlass').$on('change',hideOrShowField);
// Calling hideOrShowFieldon form loading
hideOrShowField();
});
Dear Jana,
The code looks correct. Are you using SharePoint forms or Public Web Forms? For public web forms you only need to change fd.spRendered to fd.rendered and it should work.
If you're using SharePoint forms and it's not working, please, check browser's console for errors and post a screenshot here, we'll see what exactly fails.
Also, make sure is not commented out - if it's all green/blue, it's commented out, it should be in color:
Hello, I am experiencing the same issue sorta. FYI, I am not a coder. I've tried all the scripts that I've found relating to this around this site and nothing has worked. I am using public forms.
When the user selects 'Yes' from a dropdown (Yes/No option) the attachment field is made required or they get an error and cannot proceed. I tried the code below, but it didn't work.
I then tried to just show/hide and that didn't work either.
What am I doing wrong?
Thank you in advance for your assistance.
Thanks @Nikita_Kurguzov. I've made the corrections as you stated. It's still not working for me, though. The form loads up, and the attachment field (MaskFitUpload) is not hidden.
fd.Rendered(function() {
function hideOrShowAttachment() {
if (fd.field('FitTestCompleted').value == 'Yes') {
// Show Attachment field
fd.field('MaskFitUpload').hidden = false;
} else
{
// Hide Attachment field
fd.field('MaskFitUpload').hidden = true;
}
}
// Calling hideOrShowAttachment when field value=Yes
fd.field('FitTestCompleted').$on('change', hideOrShowAttachment);
// Calling hideOrShowAttachment on form loading
hideOrShowAttachment();
});