How to Fill in Google Form Using Javascript

908 views
Skip to first unread message

Ganee

unread,
May 27, 2021, 6:15:28 AM5/27/21
to Autofill Chrome Extension
I have a field Day in Google Form.

I would like to use this JavaScript 

var arrayOfWeekdays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]

var dateObj = new Date()
var weekdayNumber = dateObj.getDay()
var weekdayName = arrayOfWeekdays[weekdayNumber]

This entire code doesn't work in the variable tab. I tried putting this into the JavaScript field tab, but I can't get the input field name in Google Form. Any help?

Autofill Chrome Extension

unread,
May 30, 2021, 4:48:27 PM5/30/21
to Autofill Chrome Extension
What type of field is Day? (e.g., dropdown, text)

Can you provide link to this form?

Ganee

unread,
May 30, 2021, 9:30:30 PM5/30/21
to Autofill Chrome Extension
It's a text field.


The field name is "HARI". It's the name of the day. So basically, I am trying to get today's date and get the name of the day.

Autofill Chrome Extension

unread,
Jun 8, 2021, 7:06:03 PM6/8/21
to Autofill Chrome Extension
You have uncovered a bug in Autofill where you cannot have a space before or after "=" in your JS code. This will be fixed in the next release. In the meantime, this will work -- enter in Variables tab:

day = javascript:let aDays=['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; aDays[(new Date()).getDay()]

Ganee

unread,
Jun 8, 2021, 9:49:24 PM6/8/21
to Autofill Chrome Extension
Thanks a lot! It works beautifully. 

I would like to find out if the variable section only allows a single line of JavaScript? I can't create multiple lines of function in there?

Autofill Chrome Extension

unread,
Jun 13, 2021, 6:07:33 PM6/13/21
to Autofill Chrome Extension
That is correct, variable assignment is limited to one line per variable (treat a variable like a bookmarklet).

Autofill Extension

unread,
Jan 29, 2022, 11:49:03 PM1/29/22
to Autofill Extension
This bug has been fixed in v10.
Reply all
Reply to author
Forward
0 new messages