Category Archives: Pedantry

Meta nonsense

It’s conceivable you noticed some layout changes here recently. I finally embraced the fact that it’s the 21st century and jiggered the CSS and headers of the blog theme to something that works properly on smartphones.

On an unrelated note, expect the gallery to go offline for a little while. The old beast is due for some hardware upgrades and was never built to hold as much as it does.  A redesign for that portion of the site is likely.

Pardon our dust and all that.

Delete Unchanged Form Fields

function detectChanges(oForm){
var elements = oForm.elements;
for (i = 0; i < elements.length; i++) { field_type = elements[i].type.toLowerCase(); if (field_type == "text" || field_type == "textarea"){ if (elements[i].value == elements[i].defaultValue){ elements[i].value = ""; }}} return true; }

Would you prefer to have visitors not submit text they didn't bother to change from default on your form? Set the submit button to run the above javascript function onclick. It simply iterates through each element of your form, and for each "text" or "textarea" field that still has its default value, it clears the content out. The function returns "true" so the submit proceeds normally.

Useful for long forms that include a lot of optional fields and nobody wants to explicitly test each value in whatever accepts the submission. It's client-side, so nothing should be written to rely on these fields being blank, of course. Your mileage may vary.