I'd like to force the numeric pad (numpad) on mobile for all of my numeric text fields in my cred form. It'll be great if I could use the "inputmode=decimal" html attribute...but any other method that does the job for both iOS and Android devices will do.
Hello, at this time there isn't a built-in way to choose a different keyboard style for each input field in a Form. The text input type is used for most of the simple fields. However, you might be able to use custom JavaScript to manipulate the system-generated inputs after the page with the Form is rendered. Here's an example of setting a property on a basic text input field:
jQuery(document).ready(function($) {
setTimeout(function() {
$('input[name="wpcf-fieldslug"]').prop('property','value');
}, 500 );
});
In this example you would change fieldslug to match your custom field slug, change property to the name of the input property you want to manipulate, and change value to the desired property value. I have used type=number in the past...I'm not familiar with inputmode=decimal, but the process would be basically the same. This workaround isn't ideal, so if you'd like to see specific soft keypad support added to the software, I encourage you to submit your request over here: https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
Your submissions could influence which features are added to the software in the future.
My issue is resolved now. Thank you!
One final ask: what are the setbacks of using this method?
One final ask: what are the setbacks of using this method?
- The main thing to keep in mind is this is not how the software was intended to be used. It is not tested or guaranteed to work, and bugs related to this type of custom field manipulation will not be addressed by our developers. The types of problems that this workaround may introduce are unknown and unpredictable. However if this is a major project requirement, then you may test it out and find it works well enough to justify those risks.
- The input type is not correct when the Form is first loaded on the front-end of the site. This code switches the input type after a short period of time. Ideally the input would be the correct type when the page is first loaded, but the change happens so fast it probably won't be possible to see or use the wrong input type in the Form.
- The input type in wp-admin is not identical to the input type in Forms. This means it may be possible to enter data in one side that is invalid on the other side. I'm not sure, I would keep that in mind when testing.
- After the Form is submitted, different things can happen depending on the configurations. If the page reloads and the Form is still visible, I would test the input field for a second submission.