Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Force Numeric Keyboard for Mobile Device

I have a single row O/E question and would like, by default, for the numeric keyboard to appear for any mobile device.

I assume there is some CSS that can trigger this?

Any suggestions?

Thank you.
asked Jun 1, 2017 by Paul Moon Platinum (74,830 points)

1 Answer

0 votes
Our numeric question may already suit your needs for this task.  If you need this behavior for an open-end, you'll need to use JavaScript to make some changes to the HTML, but there are a few ways to do this that might result in some keyboard differences on mobile devices.  One simple way would be to simply change type=text to type=tel:

<script>
$(document).ready(function(){
    $('#[% QuestionName() %]').attr('type', 'tel');
})
</script>
answered Jun 1, 2017 by Zachary Platinum Sawtooth Software, Inc. (123,525 points)
That's all I needed thanks Zachary. I just tested it out and it works spot on.

I have a phone number in an O/E field and the client does not want strict validation rules applied, hence the O/E field without any regex applied.

But having the numeric keyboard pop up for mobiles was the icing on the cake.

Much appreciated and as always, a very handy solution. Thanks for your generosity.
...