dashed-slug.net › Forums › Fiat Coin Adapter extension support › IBAN validation on fiat coin adapter
Tagged: Fiat, Iban, validation, withdraw
- This topic has 3 replies, 2 voices, and was last updated 2 years, 11 months ago by alexg.
-
AuthorPosts
-
December 29, 2021 at 7:57 am #11314AnonymousInactive
Sir please how do I disable the long validation of Iban in the fiat withdrawal form? I just need numbers only from 9 digits and above. I want anything from 0-9 and it must not be lesser than 9 numbers. Eg. 012345678 should validate.
The Iban minified Js script is not giving me the freedom to achieve that.
December 29, 2021 at 11:13 am #11316alexgKeymasterHello,
Currently it is not possible to disable validation. I have added this option in the upcoming major release.
As a temporary measure, for now, you can do the following:
1. Delete the minified javascript file:
wallets-fiat-0.6.3-beta.min.js
. This will cause the plugin to fall back to using the unminified version,wallets-fiat.js
2. Edit the
wallets-fiat.js
file as needed to conform to your validation requirements, if any.If you change line 116 from:
return val && IBAN.isValid( val ); // check not empty, and valid iban format
to
return val.match( /^\d{9,}$/ );then this will disable IBAN validation, and will check if the value has at least 9 digits
That’s it! (You can optionally minify the file if you want, but it’s not necessary.)
As a sidenote, if you need to modify the error message for this field, use the
wallets_fiat_ui_text_iban_invalid
filter, like so:add_filter( 'wallets_fiat_ui_text_iban_invalid', function( $text ) { return 'The number must be at least 9 digits long'; } );
And if you need to modify the name of the field (IBAN), you can do so with the
wallets_fiat_ui_text_iban
filter:add_filter( 'wallets_fiat_ui_text_iban', function( $text ) { return 'Foo'; } );
Finally, if you need to modify the name of the option:
add_filter( 'wallets_ui_text_swiftbiciban', function( $text ) { return 'Other option'; } );
Please let me know if you have any questions.
with regards
December 30, 2021 at 10:02 am #11318AnonymousInactiveI love the way you take time to construct an understandable replies. Thanks a lot. This is what I need most because regex confuses me though I don’t know js much /^\d{9,}$/
Thanks for all the other instructions because they mattered too. And it’s now fixed. Thanks.December 30, 2021 at 12:48 pm #11321alexgKeymasterThanks, good to hear that this helped.
Normally I don’t recommend that users edit the code, because any changes are overwritten by subsequent updates to the plugin.
But this is a special case, as the fiat coin adapter will be merged to the parent plugin, as a fiat wallet adapter.
You can rely on the fact that the WordPress text filters will be preserved.
However, the JavaScript validation code will have to be different. Ask me again about this when the time comes to upgrade. It will be very easy to override frontend JS code in the next major version, using the new templates format.
-
AuthorPosts
- You must be logged in to reply to this topic.