TOPIC:

Problems to validate Spanish DNI in form 2 weeks 2 days ago #279238

  • Topic Author
  • arancha21
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 51
  • Thanks: 0
Hello,
I have created a form with the fast mode of breezing forms and I want to validate a Spanish DNI or NIE. In the forum I have seen a script but I have tried it by adding it to the Manage Scripts menu, and in the form I have added it to the element in the Validation - Library part but I can't get it to work. What am I doing wrong?
The code is this, although it only works for DNI, but at least I could test if it works:

function ff_txt_nif_cif_validation(element, message)
{
var num = ff_getElementByName('txt_nif_cif').value;
var numero = num.substr(0,num.length-1);


var let = num.charAt(8);


numero = numero % 23;

var letra='TRWAGMYFPDXBNJZSQVHLCKET';

letra=letra.substring(numero,numero+1);


if (letra!=let){
return message;
} // if
return '';
} // ff_txt_nif_cif_validation

Please Log in or Create an account to join the conversation.

Problems to validate Spanish DNI in form 2 weeks 2 days ago #279244

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 11753
  • Karma: 3
  • Thanks: 761
Hi,

please try like this:
function ff_txt_nif_cif_validation(element, message)
{
var num = ff_getElementByName('txt_nif_cif').value;
var numero = num.substr(0,num.length-1);

var let = num.charAt(8);

numero = numero % 23;
var letra='TRWAGMYFPDXBNJZSQVHLCKET';
letra=letra.substring(numero,numero+1);


if (letra!=let){
if (message=='') message = element.name+" faild in my test.\n"
        ff_validationFocus(element.name);
        return message;
} // if
return '';
} // ff_txt_nif_cif_validation

UPDATE: I fix the code directly in site like (change the name of function):
function ff_txt_nif_cif (element, message)
{
var num = element.value;
var numero = num.substr(0,num.length-1);

var let = num.charAt(8);

numero = numero % 23;
var letra='TRWAGMYFPDXBNJZSQVHLCKET';
letra=letra.substring(numero,numero+1);


if (letra!=let){
if (message=='') message = element.name+" faild in my test.\n"
        ff_validationFocus(element.name);
        return message;
} // if
return '';
} // ff_txt_nif_cif



Regards,
Tihana

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic.

Problems to validate Spanish DNI in form 2 weeks 2 days ago #279248

  • Topic Author
  • arancha21
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 51
  • Thanks: 0
Hello,
I have added this script in the Manage Scripts menu and in the form, in the specific element I have marked in Validation-Library-Script the one that we have generated called ff_txt_nif_cif_validation but when completing this form and marking a valid or invalid NIF the form does not work and does not go to the next page.
What am I doing wrong?
I send two screenshots.

Please Log in or Create an account to join the conversation.

Problems to validate Spanish DNI in form 2 weeks 2 days ago #279250

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 11753
  • Karma: 3
  • Thanks: 761
Hi again,

can you please send me login information, backend link and form name that I can check it?

If yes, please use this tag:
[confidential]
[/confidential]

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Problems to validate Spanish DNI in form 2 weeks 2 days ago #279251

  • Topic Author
  • arancha21
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 51
  • Thanks: 0
I would prefer to send her an email with the credentials, is it possible?

Please Log in or Create an account to join the conversation.

Problems to validate Spanish DNI in form 2 weeks 2 days ago #279252

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 11753
  • Karma: 3
  • Thanks: 761
Hi,

yes, please send it tomy mail: tk@evolutio.hr

Please mark this topic :)

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Time to create page: 0.052 seconds

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!