- Installing SureForms
- Creating and Publishing a Form
- Managing Forms
- Importing & Exporting Forms
- Instant Forms
- Quick Action Bar
- SureForms Fields Guide
- How To Upgrade Your SureForms Plan
- Input Patterns
- Manage SureForms Licenses
- Create Multi Step Forms In WordPress
- Export Form Entries In SureForms
- Webhook Conditional Logic
- How to Fetch Query Parameters from URL
- Entries Management Feature Guide
- How to Activate License Key on WordPress Multisite
- Conversational Form
- How to Add Custom CSS for Specific Elements in SureForms
- Using Calculations in SureForms: A Step-by-Step Guide
- Integrating SureForms with OttoKit
- Webhooks
- Background Styling
- Digital Signature
- How to Change Checkbox Value from “On” to “Yes” (or Custom Text)
- 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 Value from “On” to “Yes” (or Custom Text)
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 filter in your theme’s functions.php file or a custom plugin.
Was this doc helpful?
What went wrong?
We don't respond to the article feedback, we use it to improve our support content.
On this page