'How to add a comma after the list field in Gravity form
I want to add a comma after the field in Gravity form. I'm using a list field and after submitting the form there should be a comma after each name.
live form :- https://docs.ajsrp.com/t1
see the attached image https://i.ibb.co/HNVzZsS/Web-capture-26-3-2022-13560-docs-ajsrp-com.jpg
I want to add a comma after the field in Gravity form. I'm using a list field and after submitting the form there should be a comma after each name.
Solution 1:[1]
If you are trying to get an array of names separated by commas you may just want to add a new hidden field to your form that can be updated by the list of names after submission. Try adding this code to your functions.php
add_action( 'gform_after_submission_1', 'array_name_list', 10, 2 );//1 in this case is your form id
function array_name_list($entry, $form ){
$list=unserialize( rgar( $entry, '4' ) );//4 in this case is the listfield
$entry['20'] = implode(",",$list);//replace 20 with new hidden field id
return GFAPI::update_entry( $entry );
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
