Skip to content

Instantly share code, notes, and snippets.

@techjewel
Created February 6, 2020 12:43
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save techjewel/7f0c70de8ee2e7574d3f41783697b63a to your computer and use it in GitHub Desktop.
Save techjewel/7f0c70de8ee2e7574d3f41783697b63a to your computer and use it in GitHub Desktop.
<?php
add_filter('fluenform_rendering_field_data_select', function ($data, $form) {
if ($form->id != 91) {
return $data;
}
// do the dynamic part if and only the name attriibute is 'dynamic_dropdown'
// Please use the corresponding field name for your case.
if (\FluentForm\Framework\Helpers\ArrayHelper::get($data, 'attributes.name') != 'dynamic_dropdown') {
return $data;
}
// We are merging with existing options here
$data['settings']['advanced_options'] = array_merge($data['settings']['advanced_options'], [
[
"label" => "Dynamic Option 1",
"value" => "Dynamic Option 1",
"calc_value" => ""
],
[
"label" => "Dynamic Option 2",
"value" => "Dynamic Option 2",
"calc_value" => ""
]
]);
return $data;
}, 10, 2);
@yankiara
Copy link

yankiara commented May 1, 2020

Thanks a million!!!
Works perfectly <3

@kartikahuja
Copy link

woo-hoo! Thanks team

@shaoweigege
Copy link

Hello

Could you please help with this function below?

add_action('fluentform_before_insert_submission', 'your_custom_before_submission_function', 10, 3);

function your_custom_before_submission_function($insertData, $data, $form)
{
   if($form->id != 5) {
      return;
   }

   // DO your stuffs here
}

I would like to change the specific field value before storing into the database. is there an exact working example available ?

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment