This topic is locked
[SOLVED]

Force AutoUpdate on "Update Selected" hidden fields

3/21/2025 12:41:12 PM
PHPRunner General questions
L
lewis author

I have not been able to find a solution for this in either the documentation or the forum history. Please enlighten me if you have an idea.

For several tables in my project (using v. 10.91) I've enabled a default and autoupdate value to set the user and time of edit. Under Events I set the fields to be hidden. This all works great with the normal edit screen; the hidden fields update as expected.

The issue occurs when I enable "Update Selected" for a specific table's list page. I select records, click "Update Selected" (opens pop-up), check the boxes for fields to edit, edit, click Update. Other fields are correctly edited but the two hidden AutoUpdate fields don't update. I believe the issue is the need to check the box to edit the specific field. These two fields are hidden so there is no checkbox, therefore, they are not updated. I've not found a way to force the hidden fields to autoupdate with the "Update Selected" edits. The normal edit page still works fine.

On the Fields screen the "Use different settings for all pages" option does not have a separate page for "Update Selected." The Design screen does not have a field option to check the box by default. The Events screen has no separate entry for the "Update Selected" page.

  1. Is there a way to force the update through the Events screen? Or,
  2. Is there a way to force a hidden field to have its checkbox automatically checked on "Update Selected" pop-ups?
  3. Other ideas?

Thank you.

G
George Kondylis 3/21/2025

Hi Lewis,

I have similar fields in my tables to track which user edited a record and when it was modified.
I’m not using the Default or Auto-update options for this.

Instead, in the Add -> Before record added and Edit -> Before record updated events, I use the following:

$values["ModifiedDate"]=now();
$values["ModifiedBy"]=$_SESSION["UserID"];

This approach works consistently for adding new records, as well as editing and update all them. Also you do not even need to include them on the add / edit forms. So no need for hiding.
It also gives you full control to set field values manually — especially helpful if you want to apply conditions using if statements.

George

L
lewis author 3/21/2025

Bless you. That worked beautifully—simple and elegant. Thank you for taking the time to help and provide the sample code. Problem solved.