$entry only returns field ID

By: James Forster | Asked: 05/30/2024
ForumsCategory: Code Help$entry only returns field ID
James Forster asked 2 months ago
Hi guys, I've created a custom action to capture form submission data and send it to a Sharepoint List.  I'm having trouble now mapping the appropiate data to a column as the data returned in the $entry array only has the field IDs as the meta keys. Is there anyway I can show field names here instead of the IDs e.g 9 become Firstname. Thanks James Example return by $entry:
stdClass Object
    [id] => 9
    [item_key] => 860hw
    [name] => etnaetrn
    [description] => Array
            [browser] => 
            [referrer] => 

    [ip] => 
    [form_id] => 2
    [post_id] => 0
    [user_id] => 1
    [parent_item_id] => 0
    [is_draft] => 0
    [updated_by] => 1
    [created_at] => 2024-05-30 07:09:31
    [updated_at] => 2024-05-30 07:09:31
    [form_name] => Test form
    [form_key] => test-form
    [metas] => Array
            [9] => foo
            [10] => bar

1 Answers
Best Answer
Rob LeVineRob LeVine answered 2 months ago
You can take both a form id and a field id and get all the information you need by using FrmField::getOne and FrmForm::getOne and passing the ID. The return value will contain all the information you need. You can see various examples here. Alternatively, you can write your own SQL commands to get the information from the frm_fields table. btw, I think you're confusing form and field as the information pasted above is for a form, not a form entry.
James Forster replied 2 months ago

Cheers Rob, that makes sense. Will give it a go.

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