Hi all,
While I realize this is not a coldfusion question it's sort of buried in a
cfmail routine I am using to send data gathered from a form. I have an existing
error checking script I am using that covers all but one scenario in the
submission of a single field. I have a field that requires a 6 digit provider
ID number, I have the basics checked on making sure they enter something as
well as the correct number of chars, what I need is to check that all 6 digits
are in fact numbers. I'm not that great with js but I do have the following
script that I've used for a few years that works quite well. I'd love to be
able to just add to what I have to handle this.
function validateForm() {
var allOk = true;
var errorString = "The following are required fields:\n";
// require first name
if (document.ScheduleChanges.Physician.value == 'none') {
allOk = false;
errorString += "\n- No Physician Selected";
}
// require provider id
if (!document.ScheduleChanges.providerID.value) {
allOk = false;
errorString += "\n- Provider ID is required";
}
// require provider id at least 6 digit length
if (document.ScheduleChanges.providerID.value.length < 6) {
allOk = false;
errorString += "\n- Provider ID must be 6 digits";
}
// require an action before processing the request
if (!document.ScheduleChanges.ActionTaken.value) {
allOk = false;
errorString += "\n- No Action Selected";
}
// check to see which action was selected and require a reason
if they're blocking or freezing
if (document.ScheduleChanges.ActionTaken.value == 'Block' ||
document.ScheduleChanges.ActionTaken.value == 'Freeze'){
// they must submit a reason before processing the
request
if (!document.ScheduleChanges.Reason.value) {
allOk = false;
errorString += "\n- You must select a reason";
}
}
// require a date range before processing the request
if (document.ScheduleChanges.slots.value == 'SpecificTimes') {
if (!document.ScheduleChanges.specificFrom.value ||
!document.ScheduleChanges.specificTo.value){
allOk = false;
errorString += "\n- You must supply specific
times";
}
}
if (!allOk)
{
alert(errorString);
return false;
}
return allOk;
}
TIA - Bob
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w
Archive:
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3249
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15