/    Sign up×
Community /Pin to ProfileBookmark

Check digit

I am trying to implement a check digit script for an account number on a form. The form has a drop down with multiple accounts and an account number field attached for each of those.

We’ve added the new account, but are having a few problems.

The initial form was developed by contractors, but due to budget restraints we cannot ask them for help with this one!

The account number field specifies which checkdigit to execute for each account.

The check digit routine itself is scripted into a variable together with a wrapper for all the check digit scripts.

The wrapper has a debug function in it and it is getting triggered now. I don’t understand what it is telling me though.

This is the wrapper script:

[CODE]/*
* Validation Wrapper, provides a simple interface to all the number validation schemes
*
* @Param field Number to be tested
* @Param chktype Type of test to be conducted
* @return boolean indiciating whether the validation has passed or not
*/

function isValid(ofield,chktype) {
if (xfa.resolveNode(“SmartForm”).pageLoaded) {
if (chktype == “Postcode”) {
return isValidPostcode(ofield);
}
else if (chktype == “Phone”) {
return isValidPhoneNumber(ofield);
}
else if (chktype == “Date”) {
return isValidDate(ofield);
}
else if (chktype == “Email”){
return isValidEmail(ofield);
}
else if (chktype == “Currency10”) {
return isValidCurrency(ofield,10);
}
else if (chktype == “Currency12”) {
return isValidCurrency(ofield,12);
}
else if (chktype == “Number”) {
return isValidNumber(ofield);
}
else if (chktype == “Integer”) {
return isValidInteger(ofield);
}
else if (chktype == “BelconnenCheckDigit”) {
return isValidBelconnen(ofield);
}
else if (chktype == “WaterConservationCheckDigit”){
return isValidWaterConservation(ofield);
}
else if (chktype == “HousingCheckDigit”) {
return isValidHousing(ofield);
}
else if (chktype == “RatesOrLandTaxCheckDigit”) {
return isValidRatesOrLandTax(ofield);
}
else if (chktype == “Mod10CheckDigit”){
return isValidMod10(ofield);
}
else if (chktype == “DogRegistrationCheckDigit”){
return isValidDogRegistration(ofield);
}
else if (chktype == “Mod89CheckDigit”) {
return isValidMod89(ofield);
}
else if (chktype == “CaravanCheckDigit”) {
return isValidCaravan(ofield);
}
else {
xfa.host.messageBox(“Debug: No such chkytype” + chktype);
}
}
else {
return true;
}
}[/CODE]

When tabbing out of the account field for the Caravan account, I get the message:

[QUOTE]

Debug: No such chkytypeCaravanCheckDigit

[/QUOTE]

The script to link this account to the check digit in the account field seems ok though?

I’m sorry if I sound totally confused. As you can tell I’m a beginner and in way over my head. Not willing to give up on it though!

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@mrhooJan 18.2007 — You seem to have an extra space character at the end of 'CaravanCheckDigit ';

the deBug is returning a non matching input exactly as typed-

that space character prevents it matching 'CaravanCheckDigit'.
Copy linkTweet thisAlerts:
@LinauthorJan 18.2007 — Thanks for your reply. I think the space in the debug message was a typo I made in my post. I checked every occurence of 'CaravanCheckDigit' in the file and there are no extra spaces. Unfortunately...
×

Success!

Help @Lin spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...