gcgs_row_value
Description
Filter a value before it gets inserted into a row in Google Sheets.
Usage
Filter all values before they get inserted into Google Sheets.
add_filter( 'gcgs_row_value', 'my_custom_function' );
Filter values in a form before they get inserted into Google Sheets.
add_filter( 'gcgs_row_value_FORMID', 'my_custom_function' );
Filter a specific field’s value before it gets inserted into Google Sheets.
add_filter( 'gcgs_row_value_FORMID_FIELDID', 'my_custom_function' );
Parameters
value mixed
The value to be inserted.
form_id int
The current form ID.
field_id string
The current field ID.
entry array
The current entry.
original_value mixed
The original value before any filters were applied.
Examples
Send numeric values as strings
This snippet will forcefully send values as a string which can eliminate issues where numbers with preceding 0’s are removed (e.g. postal codes).
<?php
/**
* Gravity Connect // Google Sheets // Force field value to be added to the sheet as a string
*
* In some situations, there may be numbers that have leading 0's, such as zip codes. By default, these will be converted
* to numbers in Google Sheets and the leading 0's will be removed.
*
* This snippet casts the value to a string before it is sent to Google Sheets, which will preserve the leading 0's.
*
* Installation:
* 1. Install per https://gravitywiz.com/documentation/how-do-i-install-a-snippet/
* 2. Update the FORMID and FIELDID accordingly.
*/
add_filter( 'gcgs_row_value_FORMID_FIELDID', function( $value, $form_id, $field_id, $entry, $original_value ) {
return (string) $original_value;
}, 10, 5 );
Since
This filter is available since Gravity Forms Google Sheets 1.0-beta-1.10.
All Connections
All Perks
- GF Address Autocomplete
- GF Advanced Calculations
- GF Advanced Phone Field
- GF Advanced Save & Continue
- GF Advanced Select
- GF Auto List Field
- GF Auto Login
- GF Better User Activation
- GF Blocklist
- GF Bookings
- GF Conditional Logic Dates
- GF Conditional Pricing
- GF Copy Cat
- GF Date Time Calculator
- GF Disable Entry Creation
- GF Easy Passthrough
- GF eCommerce Fields
- GF Email Users
- GF Email Validator
- GF Entry Blocks
- GF Expand Textareas
- GF File Renamer
- GF File Upload Pro
- GF Inventory
- GF Limit Checkboxes
- GF Limit Dates
- GF Limit Submissions
- GF Live Preview
- GF Media Library
- GF Multi-Page Navigation
- GF Nested Forms
- GF Notification Scheduler
- GF Page Transitions
- GF Pay Per Word
- GF Populate Anything
- GF Post Content Merge Tags
- GF Preview Submission
- GF Price Range
- GF QR Code
- GF Randomizer
- GF Read Only
- GF Reload Form
- GF Submit to Access
- GF Terms Of Service
- GF Unique ID
- GF Word Count