Hi everybody, I’m trying to get the true value of Likert scales questions in php (from a gform_after_submission action) and so far the returned value is like “glikertcol1155f01cdf” etc. I’ve seen this is expected but I can’t understand how to get the true value, knowing I’ve activated scores calculation in my Likert questions from the form editor. Any help ?
add_action('gform_after_submission', 'recuperer_donnees_formulaire', 10, 2);
function recuperer_donnees_formulaire($entry, $form) {
if ($form['id'] != 27) return;
$total_points = 0;
// Questions with Likert scale
$likert_ids = array(11, 17, 18, 19, 20, 21, 22, 23, 24);
foreach ($likert_ids as $id) {
for ($sub_id = 1; $sub_id <= 5; $sub_id++) {
$valeur_sub_champ = rgar($entry, $id . '.' . $sub_id);
// Convert the sub-field value to a number
$valeur_sub_champ_numerique = intval($valeur_sub_champ);
// Add the sub-field value to the total score
$total_points += $valeur_sub_champ_numerique;
}
}
}