Setting Field Default Values Dynamically

An image of a beautiful Caldera full of crystal blue water

Caldera Forms provides many ways to set the default value of a field dynamically.

Screen shot of Caldera Forms field default being set with a magic tagThe simples method is to use the a magic tag in the field’s default value setting. Select fields have additional settings for field defaults. This is the recommended method, but may not fit the requirements of all use cases, this document covers the more complex solutions.

Before considering using other options, you should see if the default setting does what you need. If you want the value of another field — this with field sync, user meta, post meta, or query variables or a hardcoded value, this setting is probably all you need.

For more information see:

Using The Caldera Forms Shortcode To Set Field Defaults

The Caldera Forms shortcode can be used to set the field default values. This topic is covered in detail in it’s own documentation.

 

Set Field Defaults With Shortcode

Using A Filter

If you are comfortable writing PHP code, then you can use the filter, “caldera_forms_render_get_field” to change any field’s default values. This example shows how to set the default value of a specific field to the current page’s URL:

For more information see the documentation for this filter and realted filters: