Support » Plugin: Smart Forms - when you need more than just a contact form » How to limit number of digits in a cell ?

  • Resolved Bertrand75

    (@bertrand75)


    Hi,

    I´m creating a credit card form.

    How can I limit the number of digits in a cellule ? By example a visual digit of 3 numbers not less nor more.

    Thanks !

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author EDGARROJAS

    (@edgarrojas)

    Hello!

    You can use a numeric field and set its maximum value to be 999.

    Hope this helps but if it doesn’t please let me know!

    Bertrand75

    (@bertrand75)

    It´s an idea and as a minimum I should put 001 then ?

    Bertrand75

    (@bertrand75)

    sorry it doesn´t work since it doesn´t make a difference between 1 and 001. I need to force people to put 3 digits.

    Plugin Author EDGARROJAS

    (@edgarrojas)

    Oh you need leading zeroes as well, for this case you can use a custom javascript (which you can add in the javascript section of your form), please try with this:

     //AUTO GENERATED CODE, DO NOT DELETE
    (function(){var javaObject={
    
    //YOU CAN PUT YOUR CODE BELLOW
    
    //jQueryFormReference:A jquery reference of the loaded form
    AfterFormLoaded:function(jQueryFormReference){
        
              rnJQuery('#rnField185 input').attr('maxlength',3);
    
    },
    
    //jQueryFormReference:A jquery reference of the loaded form
    //formData:An object with the information that is going to be submitted
    BeforeFormSubmit:function(formData,jQueryFormReference){
        //Here you can put code that you want to be executed before the form is submitted
    }
    
    //MORE AUTO GENERATED CODE, DO NOT DELETE
    }; return javaObject;})    
    
    

    You just need to change the ‘ rnField185’ for your field id (which you can find in the advanced tab of each field’s settings).

    Regards!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to limit number of digits in a cell ?’ is closed to new replies.