View: Bulk Update Field

By: Michael Clark | Asked: 11/16/2023
ForumsCategory: How-toView: Bulk Update Field
Michael ClarkMichael Clark asked 11 months ago
Looking for a way to create a View with
  • A checkbox for each entry
  • A button that updates all selected (checked) entries to a specific value
Thanks
1 Answers
Rob LeVineRob LeVine answered 11 months ago

The way I've done something like that before is to put HTML code in the checkbox column that creates the checkbox, i.e., input type="checkbox" and then make its ID dynamic so that it includes the entry id, e.g., id="select_[id]". You'll need a button to click to do the update. Then I have jQuery that on the button click, makes an ajax call, passing it all the selected ids and then in the PHP program you parse out that list and either issue a single SQL update command or you can loop over entry id and use FrmEntryMeta::update_entry_meta() to change the value. NOTE: FrmEntryMeta::update_entry_meta will only work if there's a value and you want to change it. If there's no value there, you'll have to use FrmEntryMeta::add_entry_meta()

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right