Can you Include the "Before/After Text" formatting in Data Collection?

By: Matt Clute | Asked: 08/06/2022
ForumsCategory: General questionsCan you Include the "Before/After Text" formatting in Data Collection?
Matt CluteMatt Clute asked 2 years ago
The text box field type allows for "before text" and "after text" formatting, which can be really helpful in the case of a numbered list. The problem I am running into is that when you go to refer to the answers later, the before/after text formatting is in not included in the output. Is there a way to include before/after text formatting in the data collection? Thanks.
1 Answers
Victor Font answered 2 years ago

Before and after text content are not the same as field values. They are displayed on the front end in span elements like this: <span class="frm_inline_box">1.</span>.

Both textual elements are decorative details stored in Formidable's field definition as the prepend and append properties. This is a little hard to read, but this is how Formidable stores a field definition in the database.

a:58:{s:5:"align";s:5:"block";s:11:"form_select";s:0:"";s:9:"show_hide";s:4:"show";s:7:"any_all";s:3:"any";s:10:"hide_field";a:0:{}s:15:"hide_field_cond";a:1:{i:0;s:2:"==";}s:8:"hide_opt";a:0:{}s:10:"post_field";s:0:"";s:12:"custom_field";s:0:"";s:8:"taxonomy";s:8:"category";s:11:"exclude_cat";i:0;s:9:"read_only";i:0;s:12:"autocomplete";s:0:"";s:10:"admin_only";a:1:{i:0;s:0:"";}s:6:"unique";i:0;s:10:"unique_msg";s:26:"This value must be unique.";s:4:"calc";s:0:"";s:8:"calc_dec";s:0:"";s:9:"calc_type";s:0:"";s:11:"is_currency";i:0;s:15:"custom_currency";i:0;s:25:"custom_thousand_separator";s:1:",";s:24:"custom_decimal_separator";s:1:".";s:15:"custom_decimals";i:2;s:18:"custom_symbol_left";s:0:"";s:19:"custom_symbol_right";s:0:"";s:17:"dyn_default_value";s:0:"";s:8:"multiple";i:0;s:7:"autocom";i:0;s:10:"conf_field";s:0:"";s:10:"conf_input";s:0:"";s:9:"conf_desc";s:0:"";s:8:"conf_msg";s:31:"The entered values do not match";s:5:"other";i:0;s:10:"in_section";s:1:"0";s:7:"prepend";s:2:"1.";s:6:"append";s:3:"end";s:9:"auto_grow";i:0;s:15:"get_values_form";s:0:"";s:16:"get_values_field";s:0:"";s:12:"watch_lookup";a:0:{}s:21:"get_most_recent_value";s:0:"";s:26:"lookup_filter_current_user";b:0;s:4:"size";s:0:"";s:3:"max";s:0:"";s:5:"label";s:0:"";s:5:"blank";s:0:"";s:18:"required_indicator";s:1:"*";s:7:"invalid";s:15:"Text is invalid";s:14:"separate_value";i:0;s:14:"clear_on_focus";i:0;s:7:"classes";s:0:"";s:11:"custom_html";s:514:"

This data stream is a PHP serialized array. Even if you could save the prepend and append properties as part of the field value, you would end up having them show twice when you displayed the form again. The prepend and append properties would display as well as what you've stored in the field. So your display would look like this:

prepend "prepend-field value-append" append

If you want to display the prepend and append in a view, you just type them in as standard HTML.

Matt CluteMatt Clute replied 2 years ago

Thank you for clarifying this Victor. The end result I am trying to achieve is a paragraph that is composed of a numbered set of answers that are separated by some formatting (eg. commas). Since the before/after text are not the same as field values, could I use the approach shown here and add the associated number in front of each field ID to get a numbered list separated by commas?:

Victor Font replied 2 years ago

Why can't you just build a list object and display the data you want in an ordered list?

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community