Have an idea?

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

Restricting to two decimal places

Hi ... how would you tweak this to allow just TWO decimal places?  For currency of course?

So they could have NO decimal places, or TWO.  But not one or more than two.
asked Nov 25, 2019 by Marion Bronze (3,770 points)

1 Answer

+1 vote
Try this custom JavaScript verification:

var resp = $('#[% QuestionName() %]').val().trim();
if (resp && !/^[0-9]*(\.[0-9]{2})?$/.test(resp)) {
    strErrorMessage = 'Error.';
answered Nov 25, 2019 by Zachary Platinum Sawtooth Software, Inc. (147,200 points)
You're a legend, mate!  Perfect!