You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: I want to allow a form to be built that includes REQUIRED default fields. I dont want the user to be able to remove or alter these fields, but should be able to add and alter any additional fields they choose.
I have tried using disabledFieldButtons, which removes them for an entire field type, instead of just a specific field. I also tried using a typeUserEvents, but that didnt work either (my attempts and example below). How do I accomplish this?
var baseform = JSON.parse('[{"type":"text","required":true,"label":"First Name","placeholder":"John","className":"form-control","name":"firstname","access":false,"subtype":"text"},{"type":"text","required":true,"label":"Last Name","placeholder":"Smith","className":"form-control","name":"lastname","access":false,"subtype":"text"},{"type":"text","subtype":"email","required":true,"label":"Email Address","placeholder":"[email protected]","className":"form-control","name":"email","access":false}]');
var options = {
showActionButtons: false,
disableFields: ['autocomplete','button','file','header','starRating','paragraph','hidden'],
disabledFieldButtons: {
text: ['remove'], // disables the remove butotn for text fields
select: ['edit'] // disables the edit button for select fields
},
defaultFields: baseform,
typeUserEvents: {
text: {
onadd: function (fld) {
console.log(fld);
var $nameField = $('.fld-name', fld);
if (($nameField.val() == "firstname") || ($nameField.val() == "lastname") || ($nameField.val() == "email"))
$nameField.prop('disabled', true);
}
}
}
};
var fb = jQuery("#build-wrap").formBuilder(options);
Environment Details:
formBuilder Version: 3.8.2
Browser: Chrome
OS: Win 11
The text was updated successfully, but these errors were encountered:
Description: I want to allow a form to be built that includes REQUIRED default fields. I dont want the user to be able to remove or alter these fields, but should be able to add and alter any additional fields they choose.
I have tried using disabledFieldButtons, which removes them for an entire field type, instead of just a specific field. I also tried using a typeUserEvents, but that didnt work either (my attempts and example below). How do I accomplish this?
Environment Details:
The text was updated successfully, but these errors were encountered: