in reply to resetting form values

First of all, what you are doing is Cargo Cult programming. Granted, a lot of us started that way, and some of us fall into that trap each time we meet an unfamiliar language/system/environment, but it leads to high blood pressure and hair loss. You should first try to understand WHY something is written the way it is, and only then try to write your own.

I don't know where you picked the "supposedly standard format", but it wouldn't run in any JavaScript I ever came across. I don't even see the purpose of doing it that way: after all, if you want to display a form with empty fields, just print it that way.

But in the hope that it might do some good to you and others who might run across this article, let me write something about setting fields in HTML forms in general.

There are several options:

None of that options can be said to be Best option for all occasions. Each option involves compromises. The easier it is to implement, the slower it will likely be once it is deployed. But even HTML::FillInForm, which parses the HTML each time it displays it, is plenty fast for most applications.

And hopefully, by the time you graduate to writing scripts that need to run on a hundred-requests-per-second production server, you will have developed a feeling of when programmer convenience needs to be sacrificed to the goods of speed, and when programmer's time is better spent doing other things.