Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locked the data name field on edit mode #362

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions js/admin/ppom-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jQuery(function($) {
e.preventDefault();
$("body").append(append_overly_model);
var modalBox = $(this).attr('data-modal-id');
lockedDataName = false;
$('#' + modalBox).fadeIn();
});

Expand Down Expand Up @@ -262,11 +263,13 @@ jQuery(function($) {
/**
9- Edit Existing Fields
**/
var lockedDataName = false;
$(document).on('click', '.ppom-edit-field', function(event) {
event.preventDefault();

var the_id = $(this).attr('id');
$('#ppom_field_model_' + the_id + '').find('.ppom-close-checker').removeClass('ppom-close-fields');
$('#ppom_field_model_' + the_id).find('.ppom-close-checker').removeClass('ppom-close-fields');
lockedDataName = true;
});


Expand Down Expand Up @@ -990,7 +993,10 @@ jQuery(function($) {
if (wp_field == 'shipping_fields' || wp_field == 'billing_fields') {
return;
}
selector.find('[data-meta-id="data_name"] input[type="text"]').val(field_id);
if ( true === lockedDataName ) {
return;
}
selector.find('[data-meta-id="data_name"] input[type="text"]:not([readonly])').val(field_id);
});


Expand Down
Loading