Use Pro Forms to update an option field - how?

Hi, Can anyone explain how to use ProForm to update an option field? I just can’t get it to work.

I use ACPT to create an option field.
I create a page with a Proform on it. Only has one field. In this I retrieve the value of the option field ( The Option field name is chosen from the Dynamic data drop down )
In ProForm I set the action to Database: Update option.
In Option Data I set …
Option Name = The ACPT option field selected from the dynamic dropdown
Option Vlaue = the id of the ProForms field to retrieve the new value from
Option Type = Replace value

This all looks good to me and when run the original option value is presented in the ProForm and I can overwrite it and submit.
I get a success message.
However the option value is not updated.

Any ideas what I’m doing wrong?

Hey :slight_smile: You made the common issue to use dynamic data as “Option Name”. If you include dynamic data like {acpt_name}, this will pass the value of your option, for example “Test”. So Bricksforge will search for the option name “Test”, which does not exist.

The “Option Name” really means the plain option name :slight_smile: For example menu_slug. No brackets, no other prefix or suffixes, expect the ones which are used from ACPT in that case to build the option names.

1 Like

Many thanks Daniele,

Hmmm. Understand the curly brackets part. Yes I am an idiot!
But if I just remove them it still doesn’t work. Instead I have to use just the last part.
So ACPT field = {acpt_option_menu_slug_values1_field1}
To work I need to use = values1_field1

Would be nice if there was a list of options fields to select from, maybe an extra BF_Options entry in the dynamic data dropdown?

Q1. why doesn’t the full slug work?
Q2. I always get a success message even when it fails. Is that because it was successful at what it was trying to do and I’d given it the wrong info? Just trying to understand what would a failure be.

Thanks again.
Hope you enjoyed your holiday!

Welcome :slight_smile:

Q1: It always depends how your data provider (in your case ACPT) is saving the values into the database. They decide how to name it. Some providers are adding prefixes, some others not. So we cannot suggest you specific names. Now, you know how ACPT is storing their fields. So in the future, you know how to update the data :slight_smile:

Q2: You get a success message because indeed the process was successful. You have created a new field into the database, propably with the value of “{acpt_option_menu_slug_values1_field1}”. WordPress automatically creates a new option field, if update_option() is called and the option name does not exist. Check also here: update_option() | Function | WordPress Developer Resources (“If the option does not exist, it will be created.”)

Hope that makes sense :slight_smile:

1 Like

Thanks again.
Yes understood now.

Found all sorts of weird new entries in the options table. lol

Got it all working.

1 Like