Is there some way to set the inputmode attribute on a currency/number field? Since this is an html attribute and not CSS am not sure how to attempt it.
Found a possible here:
but javascript is not remotely my thing, so applying this to the form elements on the page I’d need some guidance.
Would be very useful since my app is targeted purely at mobile users. In addition I’d love to be able to configure the input so that it is modern style 2 decimal place for currency entry such that:
I think i have a simpler solution. The only technical thing required on your part will be to find the ID of the currency field.
Copy paste this code into the footer of the site: <script src="https://cdnjs.cloudflare.com/ajax/libs/inputmask/4.0.9/jquery.inputmask.bundle.min.js"></script>
Add the following code to the Javascript of the page, be sure to change the field ID to the ID from step 2.
var flag = false;
function checkFlag() {
if(flag === false) {
if ($(’#field0DzjGaNYp1’).html() !== undefined) {
flag = true;
}
window.setTimeout(checkFlag, 100);
} else {
var im = new Inputmask(‘99.99’);
im.mask($(’#field0DzjGaNYp1’));
Thanks Moe. I’m trying to work this out, but it looks like I need something to do this that updates the HTML element as well as the Java.
See the stackoverflow post solution:
This is all a bit beyond me but happy to experiment, but seems I need to be able to add HTML elements to affect the field to identify the direction as “Right to Left (RTL)” and also to set the input type so that the virtual keyboard calls the numberpad in the first instance.
This keeps on coming up in support so I’m just going to leave this reply with simple, clear, and clean instructions that also uses the Tadabase JavaScript API (now that this is an option).
Here’s a working demo you can check out. https://tutorials.tadabase.io/input-mask/demo
Please note that I’ve tested this with a Text Field and Currency field. The number field seems to override the input mask and will not work at the time of writing this.
Add the CDN to the Custom Footer Code found in the Tadabase Settings > Custom Header/Footer Code <script src="https://cdnjs.cloudflare.com/ajax/libs/inputmask/4.0.9/jquery.inputmask.bundle.min.js"></script>
Find the Form’s Component ID by hovering over the info icon on the Page Builder. In my case, this is component_3 so I’ll be using that in the code in step 4. This will very likely be different for your form so please make sure to update component_3 to your form components ID in the next step.
Let’s say, for example, you want the phone number to have a prefix (0197) that is uneditable, and then the user can enter the rest of the number following a specific number pattern (99 999 999 9).
Great solution, but unfortunately the validation rules don’t work when configuring this.
E.g. I have a currency input, but the minumum value needs to be 250.000.
When I configure my input form like this, and I submit a number of 350.000 and press submit, the validation rule kicks in and shows the message that the value needs to be at least 250.000.
Hey @slimpens, this kind of validation rule worked for me while using an input mask. Please see the following video and let me know if I’m missing something.
I currently combined the Javascript math function and & the decimal separator.Please have a look at the screenshot.
However, when I combine both Javascript snippets, the calculation doesn’t work