Entering numbers from right to left

Entering numbers from right to left

by Dominique Bauer -
Number of replies: 5
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hello,

When students learn to add numbers by hand, they first add the rightmost numbers, then move gradually to the left. For example, for adding 236 and 260, they first calculate 6 + 0 = 6, then 3+ 6 = 9 and finally 2 + 2 = 4. In other words, they would write 6, then 9 and finally 4.

However, on computers, numbers are usually entered starting with the leftmost digit and moving to the right. Therefore, the number 496 would be entered as 4, then 9 and finally 6.

The following example includes a script to enter the answer with the rightmost digit first then moving to the left, as a student would write it when learning how to add. So the number 496 was entered as 6, then 9 and finally 4:

ForumQuiz_20200208_1923.png?

See Input box on MoodleFormulas.org.

Average of ratings: Useful (4)
In reply to Dominique Bauer

Re: Entering numbers from right to left

by Bernat Martinez -
Thanks Dominique for sharing this, it is a very nice feature . I think it could be very useful.
Any hint how could be modified if question has several parts?
In reply to Bernat Martinez

Re: Entering numbers from right to left

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hello Bernat,

I think it is possible to do it. Take a look at input box. I put the XML code, but there is still a bug. I won't have time to fix it in the next few days. Let me know if you do.

In reply to Dominique Bauer

Re: Entering numbers from right to left

by Marc Bernat Martínez -

Hello Dominique,

I was testing your input box and by the moment I could not fix your bug. However I've improved functionality, cause If you want delete some characters from input, you cannot use the Backspace.

For more information, please check my code (https://jsfiddle.net/8hrngu0v/6/)



Average of ratings: Useful (2)
In reply to Marc Bernat Martínez

Re: Entering numbers from right to left

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hello Marc Bernat,

Many thanks for the excellent improvement of the JavaScript code: the backspace character and also the pure JavaScript code which allows a much faster typing than with my version.

Multiple parts are now handled correctly by addressing specific parts individually or with a loop, and everything seems to work fine. See Input box on MoodleFormulas.org.

Average of ratings: Useful (1)
In reply to Dominique Bauer

Re: Entering numbers from right to left

by Marc Bernat Martínez -

Hello Dominique,

Now its seems to be allright! 

Thank you very much for your work.