After my last post, I spent many days with AI trying to “Vibe-code” my way into a solution.
It ended in failure.
I was able to direct AI to craft some very nice code and I must say it is a big upgrade over what Blocs Forms give us:
- Text inside popup menus was able to be horizontally centered to match the other text fields in the form, which is the way it ought to be. The code creates a “fake” popup to accomplish that centering.
- When there is a field input error, it will outline the invalid input field in red, also offering a semi-transparent red “focus” outline, AND it adds a little circular “!” warning icon at right, inside the field itself.
- When the field is properly filled out, a blue checkmark (color chosen by me) will appear at right, inside the field.
- Code was added to allow Tabs and Arrow keys to work in the popup menu, despite the fact it’s a “fake” form input popup.
- Nobody has numbers in their first or last name, so I was able to add code to turn the field red (invalid) when anyone types numbers into the “Name” field.
But alas, the code failed in the end.
All was well when I previewed inside Blocs and when I used the View menu to Preview in-browser (FireFox, Safari, Chrome, and Edge for macOS — caches cleared). But as soon as I Export files from Blocs and then preview those files, either locally or from my web server, the popup menu vanishes, my numerical detection code in the Name field no longer works, fields with invalid text are no longer outlined in red — a complete malfunction of the form!
After much discussion with ChatGPT and Gemini (in Pro mode), and yes, the two AI’s examined all my HTML files and code blocs extensively, it appears that the code generated is fighting with Blocs generated code in terms of timing. That timing issue prevents the AI generated code from working when files have been exported from Blocs, even though everything works fine in Blocs Preview or View Menu Preview.
It was a complete and utter failure, but I have to give the nod to Gemini in Pro mode. It was the only of the two AI’s that finally admitted to me that it was throwing in the towel, unable to solve the problem. ChatGPT (in Thinking mode), wasted days of my time and refused to admit defeat, insisting it was trying something new and possibly a fix, every time it generated code.
And so, my forms must be created exclusively with what Blocs gives me, mainly because there’s no way to override Blocs, or so it would seem, to get the “timing” right.
Perhaps if some of the aforementioned enhancements can make their way into Blocs’ built-in forms, no code hacking would be necessary, and we could then have niceties like centered popup menu text, “number detection” in Name fields, field coloring, checkmarks, etc.