Results 1 to 3 of 3

Thread: Check digit

  1. #1
    Join Date
    Jan 2007

    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:

     *  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;
    When tabbing out of the account field for the Caravan account, I get the message:
    Debug: No such chkytypeCaravanCheckDigit
    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!
    Last edited by Lin; 01-17-2007 at 10:06 PM.

  2. #2
    Join Date
    Feb 2006
    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'.
    Last edited by mrhoo; 01-18-2007 at 07:47 AM.

  3. #3
    Join Date
    Jan 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...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center