Hiding fields based on checkbox
I was working in plumsail forms and realized that the style formatting described was for the spforms thus I have swapped over to see if this is more functional and easily customized. In plumsail this code works to hide fields based on checkboxes selected but I cannot figure out how to modify it to work with the spforms.
Code: Select all
//use fd.rendered(function() { for Plumsail Forms instead
fd.spRendered(function() {
function hideOrShowiTunesInfo() {
if (fd.field('iTunesAccount').value) {
// Show the iTunes Info field
$(fd.field('iTunesAccountInfo').$parent.$el).show();
} else {
// Hide the iTunes Info field
$(fd.field('iTunesAccountInfo').$parent.$el).hide();
}
}
// Calling hideOrShowiTunesInfo when the user changes the Start Date
fd.field('iTunesAccount').$on('change',hideOrShowiTunesInfo);
// Calling hideOrShowiTunesInfo on form loading
hideOrShowiTunesInfo();
});
fd.spRendered(function() {
function hideOrShowFields() {
if (fd.field('Equipment').value.indexOf("Mobile Phone")) {
// Hide the Title field
$(fd.field('AreaCode').$parent.$el).hide();
} else {
// Show the Title field
$(fd.field('AreaCode').$parent.$el).show();
}
}
// Calling hideOrShowFields when the user changes the Start Date
fd.field('Equipment').$on('change',hideOrShowFields);
// Calling hideOrShowFields on form loading
hideOrShowFields();
});
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Ben,
We have very similar code in this article, please, check it out - https://spform.com/javascript-framework ... ynamically
Also, you can find more information on getting, setting, and detecting change in fields' values here - https://spform.com/javascript-framework ... eld-values
We have very similar code in this article, please, check it out - https://spform.com/javascript-framework ... ynamically
Also, you can find more information on getting, setting, and detecting change in fields' values here - https://spform.com/javascript-framework ... eld-values
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 23 guests