Yesterday I had a interesting discussion with one of my customers. I was about freedom of choice and verification of forms...
The baseline is that sometimes input verification is a VERY BAD THING.
Example. I live in a city where groups of buildings are adressed "Q4,10" rather than "Q4 Street, Number 10" and one of my friends lives at a very remote place called "Einsiedlerhof". No street name, no house number.
I could post countless forms, where I get an error message time an time again.
"You have to fill in a correct street name (minimum 3 letters)" or "please fill in your house number". Screaming, crying and begging wont help, I can’t submit the form without tweaking my address or adding some rubish to one of the required fields. So Q4 becomes "Quadrat Q4" and my friend has to fill in house number "1" where there is no number.
After some brainstorming we came up with the idea, that rather than denying a visitor to send a form, it would be much better to ask for some corrections and if he is sure, that everything is right, to let him continue.
After submitting a form with "invalid" content, it should be returned with a message telling the visitor about a possible conflict. Next to the submit button a check box could be added labelled "I know what I’m doinig, please let me continue...". Checking the box and hitting submit again, would finally submit the form, possible error non-withstanding.
This would be a much more user friendly scenario, wouldn’t it?
Regards,
pepebe
P.S. I just added a few lines to eform.inc.php to give valid form fields the class "valid". If you are interested to add this feature to eforms, you just have to add a single line of code to the file.
Instrucions: Backup your original file (better save than sorry). Then look for the lines of code below (somewhere around line 250) and add "if(!$rClass[$name]) $rClass[$name]=$validClass;" right above the "end required test" comment.
The result should look a bit like this:
case "html":
case "checkbox":
case "string":
default:
break;
}
# Add the following lines:
# If everything is ok, add "valid" to class attribute of form field
if(!$rClass[$name]) $rClass[$name]=$validClass;
# that's all
}//end required test
}
}
// Changed in 1.4.4.5 - now expects 4 parameters
Now open your eform snippet and add under "// eForm Params" the following line:
'validClass' => isset($validClass)?$validClass:"valid",
Save and test the whole thing. If you have a problem, restore your original eform.inc.php and send me a PM...
Have fun!