We have a network of sites. There's one main site that acts as the admin panel for the rest of the sites for an event post system.
So in the main site, I have a form with a bunch of fields. One of those fields is called "On Click Action" with 3 options:
"None", "Close Popup", "Redirect To"
The redirect radio button is an "other" option where the user can enter a URL for the action to send a visitor to when they click on the event post popup.
In the "sub sites" I have the exact same form (exported from the main site and imported to the sub sites). In the main site, in the settings I have it set to post the form contents to the sub sites.
In the main site AND in the sub sites, the key on the click action field is `smdvv`. On the main site the ID of the field is 162. So the config of the API post looks like the attached (screenshot1.jpg).
But, when the form was submitted, the site it was sent to had the default value of "None" selected and no URL entered. But the keys DO match. The value is correct.
Is there something different I need to do in the config of the action to get the radio buttons value to transmit to the receiving end?
Please login or Register to submit your answer
I changed the action URL to a requestbin url and submitted the data to there to inspect the content. You can see the output here: https://snipboard.io/6leDLE.jpg
So the issue seems to be that the Formidable API functionality is receiving the value as the URL and not translating that to the other option.
That's a good guess, but it's not what's happening. The other field is actually not named 162 or 'smdvv'. In code it's referenced as 'other_2' and because it's a tack-on option to field 162, its full name in code is [162][other_2].
This is what I see in the database with a test field and only the other option populated:
a:1:{s:7:"other_2";s:17:"http://google.com";}
The reference is other_2. I don't know how you would reference the other field directly through the API, buy you could do something withe data in this hook: https://formidableforms.com/knowledgebase/frm_api_post_response/
<p>Thank you Victor.</p><p> </p><p>I have to admit I'm a bit confused. Does this mean that on the receiving site I have to add one of these hooks that will update the record AFTER the api receives and writes it? I don't really understand how the hook would be used for this since what I'm seeing is very generic. I have no idea the body would look like and I have no way to output the body to something so I can debug it.</p><p> </p><p>Would the line $returned_id = $body["CHANGEME"];</p><p> </p><p>for me be something like:</p><p>$redirect_value = $body["smdvv"];</p><p>if (stristr($redirect_value,"http")) {</p><p> // update record's other_2 value</p><p>}</p><p> </p><p>Trying to understand how to handle this.</p><p> </p><p>Thank you!</p>
argh the editor on this forum sucks. It needs markup support.
This is the first time anyone has ever asked about populating the "other" field through the API. I only know that Formidable requires it to be saved as part of the serialized data returned for the input using the other field.
This means you have to specifically identify the values key-value pair with the key "other_2" otherwise it will never populate the other field. I have no time to dig into code to find a different way, but the only thing I can recommend now is to use the hook to retrieve the value intended for the other field and dress it as a serialized array and populate the field in frm_item_metas as you would to update any meta value programmatically.