JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.
Ruby Code validationAsked by ugrinoskiwinner on August 09, 2016 at 09:15 AM
I have a question wrt verification of a number field (13 digits) with this Ruby code:def validjmbg jmbg len = jmbg.scan(/[0-9]/).size valid_chars = (jmbg =~ /^[0-9]+$/) if len!=13 or !valid_chars return false else j = jmbg.split(//).map(&:to_i) v = 11-((7*(j+j)+ 6*(j+j)+ 5*(j+j)+ 4*(j+j)+ 3*(j+j)+ 2*(j+j))%11) v = 0 if v>9 return v==j end end
Is it doable?
This is a formula that I've got for validating Unique Citizen Number.
Regarding the Ruby code, it looks fine, the length is 13, it should be numbers and then, I guess it is some kind of formula to give you the unique 13 digits number.
Now, this should be doable, but you will have to download the whole source code of your form and do some coding to apply that to a certain field.
I'm not sure how good are you in coding, but it should be doable.
If you have further questions please let us know.