This topic is locked

Copy record

10/6/2025 10:39:31
PHPRunner General questions
A
Andreas Georgiou author

When i select copy record is there an option to blank some fields out?

any suggestions please?
Thank you,
Andrew

ChatGPT 10/6/2025

Yes, in PHPRunner, when you select the option to copy a record, you can indeed customize which fields to blank out or modify in the copied record. Here are the steps to achieve that:

  1. Go to the "Copy" settings in your PHPRunner project:

    • Open your project in PHPRunner.
    • Go to the "Tables" section and select the table for which you want to configure the copy behavior.


  2. Configure the "Copy" action:

    • Navigate to the "Edit" or "Add" page settings for that table.
    • Find the "Copy" action setting, where you can define how records are copied.


  3. Use the "Before Record Added" event:

    • To customize which fields are copied and which should be blanked out, you can use the "Before Record Added" event.
    • In the Events section, find the "Before Record Added" event for the specific table.


  4. Add code to blank out fields:

    • In the code editor for the "Before Record Added" event, you can set specific fields to be blank. Here’s an example of how you might do that:

    // Check if the action is a copy
    if ($_REQUEST['action'] == 'copy') {
    // Blank out specific fields
    $values['field_name_1'] = ''; // Replace with your actual field name
    $values['field_name_2'] = ''; // Replace with your actual field name
    // Add more fields as needed
    }

  5. Save your changes:

    • After adding your code, make sure to save your changes and test the copy action to ensure that the specified fields are being blanked out as expected.



By following these steps, you should be able to customize the copy record functionality in PHPRunner to meet your needs. If you need further assistance or have specific field names or conditions in mind, feel free to provide more details!

A
Andreas Georgiou author 10/6/2025

Unfortunately i can not get this to work. anything else i can try?

G
George Kondylis 10/7/2025

Hello Andreas,

On the Events page, under the Add page section, there’s an event called Copy page: On load.
There, you can define which fields should be cleared or pre-filled with specific values, for example:
$values['FiledA'] = "";

Thank you
George

Screenshot 2025-10-07 at 09.05.03.png