Saving additional fields

In another thread I asked about accessing other field values inside of a custom controller. In the end I saved all of the values as the $value of the field and exploding the $value to separate the info for each hidden field.

Here’s an example - I’ve created a field using geocomplete, which also sets the values in a few hidden fields for lat, lng, etc. using js. This all works fine, the problem is referencing these values after the module is saved. Since I’m unable to access $settings, I have no way of setting the previous value of the hidden field.

As I see it there are 2 options for this scenario:

  • Set the $value of the field with some obscure separators to explode later, for example: Address|*|Lat|*|Long
  • Create another custom controller for hidden fields. The problem with this is that each additional field adds another td, so forms could get long depending on the amount of info I'm saving.

Is there another option I’m not seeing?

Hey Josh,

Would it be possible to send me a copy of your module to play with? My email is justin [at] fastlinemedia [dot] com. I’m out early today, but I can try to come up with a solution for you tomorrow.

Thanks!
Justin

Hello,
i’m working on same custom modules ! :wink:

some kind of a mix of geocomplete and this one :
https://github.com/mustardBees/cmb_field_map

Patrick

Sure thing Justin.

Patrick, we’ve created a class which stores bb values as post meta if you’re interested…

Hi Josh,

of course, i planned to “play” with BB this weekend :slight_smile:

lp
Patrick

Hey Josh,

I had a look at the custom module and am wondering… are you asking for access to $settings in the zestsms_geocomplete_field function? If so, that should be possible for us to do. Let me know.

Justin

That’s exactly what I’m asking :slight_smile:

Cool! Sorry I didn’t quite get that at first. Sometimes it helps to see the code :slight_smile:

I had a look and we can make that happen easily, so I’ll get that done for the next release. In the meantime, you can patch your current version by adding $settings to the fl_builder_control_ action in includes/field.php…

do_action('fl_builder_control_' . $field['type'], $name, $value, $field, $settings);

Let me know how that goes.

Justin

Fantastic, thanks!