- Calculation Formula Guide
- Using Calculations in SureForms: A Step-by-Step Guide
- GDPR Compliant Forms
- Conversational Form
- Instant Forms
- Create Multi Step Forms In WordPress
- Create WordPress Forms With Conditional Logic
- How to Create Inline Forms in SureForms
- SureForms Login Block – Step-by-Step Guide
- SureForms Registration Block – Step-by-Step Guide
- Unable to Upload SureForms ZIP: File Unzipped On Download
- Browser Support for SureForms
- Not Getting Update Notifications
- How To Rollback to Previous SureForms Versions
- Publishing Failed: Invalid JSON Response
- Troubleshooting Email Sending In SureForms
- SureForm Submissions Marked as Spam
- API Request Failed – Nonce Verification Error
- Fixing the “Destination folder already exists” Error When Installing SureForms
- srfm_core_loaded
- srfm_form_submit
- srfm_after_submission_process
- srfm_localize_conditional_logic_data
- srfm_form_css_variables
- srfm_page_break_header
- srfm_page_break_pagination
- srfm_page_break_btn
- srfm_register_additional_post_meta
- srfm_before_submission
- srfm_before_email_send
- srfm_after_email_send
- How to Change Checkbox Submission Value from “On” to “Yes” or Custom Text in SureForms
- srfm_after_deleting_entry_files
- srfm_before_prepare_submission_data
- srfm_register_additional_blocks
- srfm_entry_render_field_custom_value
- srfm_entry_custom_value
- srfm_enable_redirect_activation
- sureforms_plugin_action_links
- srfm_quick_sidebar_allowed_blocks
- srfm_integrated_plugins
- srfm_suretriggers_integration_data_filter
- srfm_form_submit_response
- srfm_enable_gutenberg_post_types
- srfm_languages_directory
- srfm_form_template
- srfm_disable_nps_survey
How to Change Checkbox Submission Value from “On” to “Yes” or Custom Text in SureForms
By default, when a user selects a checkbox in a SureForm, the submitted value appears as “on”. If you want to change this value to something more user-friendly like “Yes” or localize it based on the site language, you can easily do this using a filter.
add_filter('srfm_before_prepare_submission_data', function($submission_data) {
foreach ($submission_data as $key => $value) {
if (strpos($key, 'srfm-checkbox') !== false || strpos($key, 'srfm-gdpr') !== false) {
$submission_data[$key] = ($value === "on") ? __( "Yes", "sureforms") : __( "No", "sureforms");
}
}
return $submission_data;
});
How it works:
- This filter runs before form data is saved or sent.
- It checks if the submitted field is a checkbox.
- If selected, it replaces “on” with “Yes”.
- The __() function ensures it’s translation-ready if you’re building a multilingual site.
Customize for your language or terms:
You can modify the “Yes” to fit your site’s tone or language. For example:
__( "Ja", "sureforms") // German
__( "Oui", "sureforms") // French
__( "Sim", "sureforms") // Portuguese
To ensure the custom text shows correctly in email notifications or webhook data, make sure to place this code in your child theme’s functions.php
file or use a plugin like Code Snippets to safely insert custom code. Using a code snippet plugin is recommended for easier management and to ensure the code remains active even if you switch themes.
We don't respond to the article feedback, we use it to improve our support content.