From 28813db155d26dea1af75ae496b7f652e1a66d3f Mon Sep 17 00:00:00 2001 From: Haneef <298208+haneef95@users.noreply.github.com> Date: Tue, 23 May 2023 16:49:15 +0100 Subject: [PATCH 1/2] // This has also been tested to work with GP Populate Anything. --- .../gppa-select-first-random-choice-on-radio.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gp-populate-anything/gppa-select-first-random-choice-on-radio.js b/gp-populate-anything/gppa-select-first-random-choice-on-radio.js index c32c556db..5a345696a 100644 --- a/gp-populate-anything/gppa-select-first-random-choice-on-radio.js +++ b/gp-populate-anything/gppa-select-first-random-choice-on-radio.js @@ -6,5 +6,8 @@ * https://gravitywiz.com/gravity-forms-custom-javascript/ */ -// Update "4" to the the ID of your Radio Button field. -$( 'input[id^=choice_' + GFFORMID + '_4_' )[0].checked = true; +// This has also been tested to work with GP Populate Anything. +// Update "3" to the the ID of your Radio Button field, and keep it as "0" for for the first choice. +// Rename "SelectDefaultRoomType" to something unique. +const SelectDefaultRoomType = document.getElementById('choice_' + GFFORMID + '_3_0'); SelectDefaultRoomType.click(); + From 1c0f038fd6aefd7f014987475915d31ef4cb73a9 Mon Sep 17 00:00:00 2001 From: Haneef <298208+haneef95@users.noreply.github.com> Date: Tue, 23 May 2023 17:06:12 +0100 Subject: [PATCH 2/2] Clarified comment. --- .../gppa-select-first-random-choice-on-radio.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gp-populate-anything/gppa-select-first-random-choice-on-radio.js b/gp-populate-anything/gppa-select-first-random-choice-on-radio.js index 5a345696a..61e31bf2a 100644 --- a/gp-populate-anything/gppa-select-first-random-choice-on-radio.js +++ b/gp-populate-anything/gppa-select-first-random-choice-on-radio.js @@ -6,7 +6,7 @@ * https://gravitywiz.com/gravity-forms-custom-javascript/ */ -// This has also been tested to work with GP Populate Anything. +// click vs checked: Click triggers other GPPA Fields to be populated appropriately as well, whereas checked does not trigger further reloads. // Update "3" to the the ID of your Radio Button field, and keep it as "0" for for the first choice. // Rename "SelectDefaultRoomType" to something unique. const SelectDefaultRoomType = document.getElementById('choice_' + GFFORMID + '_3_0'); SelectDefaultRoomType.click();