Forum Discussion
Can I prevent "NaN" from appearing in numerical entry?
Thanks for sharing the solution that worked for you in this thread, Kevin! I'm sure it will be helpful to other community members that come across this post.
Have a great day, and happy developing! ✨
Hey Storyline Peeps, I built a Sum of Ratios calculator for a client. it's proprietary so I can't share it but wondered if there has been any non JS solutions for this. essentially, the user plugs in lab results and it determines the sum of ratios. It all works great until someone goes back into a field and deletes the entry or hits backspace. then all the calculations giv NaN because the deleted default is not an actual 0. if you overwrite it with a zero, itt all works again but this is not very user friendly. BTW, I tried to add the JS that was suggested above and it just ignored it. (Yes, even when published to Review) any new ideas? is this something that Articulate is working on? it's been 13 years since the first complaint.
- Nedim4 months agoCommunity Member
You may try below. But it all depends on your current setup.
var num = getVar("NumericEntry"); if (num === "" || isNaN(num)) { setVar("NumericEntry", 0); }
Related Content
- 2 months ago
- 2 years ago
- 4 months ago
- 11 months ago