Hello
I am working on a form to create and edit CPT. The form output is in a bootstrap modal.Two fields do not work correctly.
The link-filed button is displayed correctly in the form, but clicking on the button does not trigger the selection popup.
The file field (upload) works correctly when creating the post. In the edit-form, however, it is not possible to delete or replace the file. Clicking on the corresponding cross icon when hovering the file display does nothing.
No errors are displayed in the console and there are no hints in the log file either. The function acf_form_head()
is called before get_head()
.
The setup is PHP 8.1, WP 6.5.5, ACF Pro 6.3.3, SCRIPT_DEBUG/WP_DEBUG is set to true.
Many thanks for tips and hints!
I have to correct myself. When I write link field, I mean the ACF file field. The information entered for this field is used for a download link, so I mistakenly called it Link field.
I found the way to fix the file field: The form html in the bootstrap modal is set from an Ajax request. At acf_form() I found the hint, that acf.do_action('append', $('#popup-id'));
must be called after an Ajax request.
With this function call in the event-listener shown.bs.modal
deleting/replacing of the file works.