Is it possible to add a prefix value in certain cell in list field? Please help
Hi Alvin. Do you want to show it in the cell, but not save it, or do you need to save the value with the prefix? Can you share any additional requirements?
Hi Chris, thanks for your response. I need to save the value with the prefix
In that case, you could use the gform_pre_submission filter to add the prefix to the submitted value: https://docs.gravityforms.com/gform_pre_submission/
The code would look something like this:
// Change 17 to your form ID
add_action( 'gform_pre_submission_17', 'prefix_the_value' );
function prefix_the_value( $form ) {
// Change INV= to whatever your prefix is
$prefix = "INV-";
// Change 14 the id your field
$_POST['input_14'] = $prefix . rgpost( 'input_14' );
}
didn’t work for me. Just because i cannot find the right field id of specific cell in the list field.
It’s tricky when finding the ID of a specific cell in the list field. How can i know which is which? See my screenshot - https://snipboard.io/jcXW87.jpg
In your pre_submission code, I recommend logging the $_POST so you can see what it contains and then you will have an idea of how to find that value for the cell. Here is how you add custom logging statements to your code:
You will need to enable logging in order for your logging statements to do anything useful: