This topic is locked

autofill fields not working if the secondary field is a look up field

12/2/2025 04:11:01
PHPRunner General questions
J
jacktonghk authorDevClub member

Let say I have a field 'Item No.' which is a look up field and will autofill 'Description' and 'Type'. Field 'Description' is a text field and it recieved the value correctly. However, field 'Type' itself is a look up field but it did not receive the autofill value from 'Item No.' I am using phprunner 11.1.

Best regards
Jack Tong

ChatGPT 12/2/2025

Hi Jack,

In PHPRunner, when you're working with autofill fields, especially when it comes to look-up fields, it can sometimes be tricky to ensure that all dependent fields are populated correctly. Here are a few steps to troubleshoot and resolve the issue with your 'Type' field not being autofilled correctly:

  1. Check Look-Up Settings:

    • Make sure that the 'Type' field is properly configured as a look-up field in your database and PHPRunner project.
    • Ensure that the look-up field for 'Type' has the correct settings to retrieve values based on the selection made in the 'Item No.' field.


  2. Add Autofill Settings:

    • Go to the 'Item No.' field settings in PHPRunner.
    • Under the "Edit as" section, ensure that both 'Description' and 'Type' are included in the "Autofill" settings. Sometimes, the fields may need to be added explicitly for autofill to work.


  3. JavaScript Customization:

    • If the standard autofill feature is not working as expected, you might need to add some custom JavaScript code to handle the autofill for the 'Type' field.
    • You can use the onchange event of the 'Item No.' field to manually set the value of the 'Type' field based on the selected 'Item No.'.

    Here’s a sample code snippet you could use:

    $("#your_item_no_field_id").change(function() {
    var selectedItemNo = $(this).val();
    // Make an AJAX call to fetch the associated Type value based on selected Item No.
    $.ajax({
    url: 'get_type.php', // Create a PHP script to retrieve the Type based on selected Item No.
    type: 'GET',
    data: { item_no: selectedItemNo },
    dataType: 'json',
    success: function(data) {
    $("#your_type_field_id").val(data.type_value); // Set the Type field value
    }
    });
    });

    Ensure to replace your_item_no_field_id and your_type_field_id with the actual IDs of your fields.


  4. Database Integrity:

    • Verify that the data in the database is consistent and that there are no missing relationships or entries that could prevent the autofill from functioning correctly.


  5. Testing:

    • After making changes, test the functionality to ensure that both fields are being populated correctly when selecting an 'Item No.'.



If you still encounter issues after trying the above steps, please provide any error messages or specific behaviors you're observing, and I would be happy to assist you further.

Best regards,
[Your Name]

Sergey Kornilov admin 12/2/2025

We have tested this on our side and Autofill works as expected with Lookup wizard fields. If your Link field and Display field are different make sure that autofill uses a correct Link field value.