Skip to content

Conversation

@sonhv3112
Copy link

@sonhv3112 sonhv3112 commented May 29, 2025

Description

The current fill entries flow is filling all entries that the form has, and it will create an invalid answer for the form if that form has some conditions, like if A is selected in question Q then the next page is P or in case next page of P is P' that not P + 1, so in these cases we expect some pages are skipped and entries belong to these pages must not be filled.

Solution

First, we need to find:

  • Entries that each page contains and what its default next page is. In the code, I used the [5] field of each entry to determine the next page ID.
  • For each question's answer, what the next page will be. I used the [2] field of each entry's option to determine the next page.

Then, I modified the fill_form_entries function a bit to use a loop that starts filling all the entries from the current page, beginning from page 0, and continues until the end page is reached.

Note:

  • For pages configured with a "go to page" question or that are the end of the form, the next_page_id = -1.
  • The pageHistory entry is moved to fill_form_entries for processing and will always have a value ranging from 0 to len(pages) - 1.
  • The entry for emailAddress will be handled specially by appending it to the end of page_entries as a separate page, and fill_form_entries will check and handle it separately.

@tienthanh214
Copy link
Owner

tienthanh214 commented Jun 2, 2025

Thanks for your incredible work!
After testing some forms, I've noted a couple of points:

  • Field [5] appears to be referencing the next page ID of the previous page, rather than the current one.
  • The 'Other' choice in multiple-choice questions seems to be missing the logic to direct to a specific page as configured.

I need to do a bit more work on this before merging.

Update:

  • I also found that Google form allows cycle 😃 (just like a linked list with cycles)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants