• Resolved metanoia77

    (@metanoia77)


    Hello
    CFF: Version 5.0.6

    Simple Problem

    I have a Text Field where the user has to enter alphanumeric CCCNN (c=char n=numeric )
    I am trying to mess with it using this snippet I got from the FAQ page

    (function(){
    var text = 'fieldname75';
    text = text.replace( /[\s\t\r\n]/g, '' ); // not needed but copied from FAQ 
    return text.length;

    })()`

    now when it is :
    BLANK it returns “1”
    CCCNN it returns “7”
    CCC10 it Returns “2”
    CC123 it Returns “3”
    12345 it returns “5”

    So it appears that somehow var text = ‘fieldname75’; is only passing Numerics in var text = ‘fieldname75’; when there is a numeric in the text field ?? and why does a blank field have a len value of 1 ??
    But …
    What I am trying to do is simple

     function () {
        var text = prompt("Please enter your Code format CCCNN C=Char N=Number", "");
        var valarray = ['ASK10', 'ASK15', 'SHO10'];
        var disc
    
        if (text === "") {
          return 0;  // Blank no Code Entered so no calc to do 
        } else {
    // Check for valid code - is it in array .. only 12 valid codes 
          if (valarray.indexOf(text) > -1) {  // yes we have a valid code
            disc = text.substr(3);
            disc = parseInt(disc, 10);
            return disc;  //  the NN of CCCNN for Calculations
          } else {
            return 99;  // Code entered but not valid no match to array 
          };
        };
      }
    
    })()

    Test at JSFiddle very hacky noddy script for 10 alphanumeric codes
    https://jsfiddle.net/exclusiveor77/n3o8jftk/3/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @metanoia77,

    Please, install the latest version of the plugin, and use your function as the equation associated to the calculated field but with some simple changes:

    (function () {
        var text = fieldname75,
              valarray = ['ASK10', 'ASK15', 'SHO10'],
              disc;
    
        if (text == 0) {
          return 0;
        } else {
          if (valarray.indexOf(text) > -1) {
            disc = text.substr(3);
            disc = parseInt(disc, 10);
            return disc;
          } else {
            return 99;
          };
        };
      }
    })()

    Tip: Don’t use single line comments into the equations.

    Best regards.

    Thread Starter metanoia77

    (@metanoia77)

    Hello
    Than you for prompt reply

    I only put the comments in the JS here to make it easy to read (Its not in the the site ). The new code still doesn’t work I assume that is because I am not on the latest version ? Well look at record #610592 on your own support system. I not informed of updates even though I bought the plugin. So how do I get the update please ?
    Thank you

    • This reply was modified 8 years ago by metanoia77.
    Plugin Author codepeople

    (@codepeople)

    Hello @metanoia77,

    To get the updates directly in your WordPress, you simply should register your copy of the plugin, please, visit the following link for details:

    https://cff.dwbooster.com/documentation#register

    If you have any question about the pro version of the plugin, please, create a new ticket in our private support service.

    Best regards

    Thread Starter metanoia77

    (@metanoia77)

    Hello
    you guys seem to think we bought a calendar plugin – which I have never heard of. I have opened a ticket #634333 on https://www.hotdreamweaver.com/support and restarted #610592
    As the solution above doesn’t work and on our version of the plugin there is no https://cff.dwbooster.com/documentation#register
    that is explained in #610592 and #634333 explains with images we have CFF not a calendar plugin
    so respectfully nothing is resolved and my @ss is being fried ??
    I gave the plugin 5 stars and respectfully I can show I am using CFF and the email of the purchaser. Everyone is on my case at my end moaning at me and no one is answering the two tickets for a simple fix -> please send me the latest version so I can put the code above in and fix the the problem.
    No one has a calendar. ??
    Please help me it not pleasant being fried

    Thread Starter metanoia77

    (@metanoia77)

    Hello Thank you I got the latest version and am testing it now ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Alphanumeric Entries in Text Field Annomalies – Chars Stripped Leaving Numbers’ is closed to new replies.