- ugrinoskiwinnerAsked 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.
- JotForm SupportNik_CAnswered on August 09, 2016 at 11:00 AM
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.