Thanks for the prompt and detailed reply.
Hence in conclusion there is no ability to directly use field key to set value. I need to get the field ID through get_id_by_key first then use the ID to set or retrieve value for the field?
Not using the PHP $_POST array. The PHP $_POST array stores the field value by HTML input name.
I need not use $_POST in PHP. Is there another method that I can use to directly change a field using field key using PHP?
If you want to change the value of a field before the entry is created, you have to use $_POST. The values in $_POST are what's written to the database. If you want to change a field value after the entry has been saved, there are several ways to do it including using your own custom SQL. No matter what technique you use, you still have to use get_id_by_key(). The field key is not stored with the data. It is stored in a completely different table and not related to how data is stored. The Formidable database schema may help with understanding how Formidable stores values in the database. https://formidableforms.com/knowledgebase/database-schema/
Ok. Got it which means it is rather inefficient as I've to get the field id based on field key and then use the $_POST with the field id.
Thanks.
This is the way any form (not just Formidable) submits data to a PHP back end.
Please login or Register to submit your answer