Grrrr....cannot add fractions in a fill in the blank
Submitted by MsCdiana on Thu, 02/09/2017 - 17:17
Am trying to create an interactive math video. I have found that if I use a fill-in-the-blank, I cannot have an answer that is a fraction such as 2/3 because I assume the / in a response triggers something different. I hav correctly put in the text for the answer as *2/3* Yet, when you enter the response 2/3 in the blank it comes up as incorrect, but when you select 'show solution' it comes up as the correct answer 2/3.....hmmmmm.
Support for fractions (escape character)
0Supporter votes Members of the Supporter Network can vote for feature requests. When the supporter network has generated sufficient funding for the top voted feature request it will normally be implemented and released. More about the H5P Supporter Network
Thu, 02/09/2017 - 22:57
Sorry to hear that you are
Sorry to hear that you are running into trouble with Fill in the Blanks. The slash (/) is used for separating alternative answers as described when entering the text, so the solution button showing 2/3 means that either 2 or 3 is correct. I assume that fill in the blanks had been created with text in mind, not numbers.
In fact, there's a pull request pending that would offer a workaround using so called regular expressions, but that would really be a "detour". You'd have to write *[[[2\/3]]]*. Anyway, the pull request is still in review and not implemented, and even with it being accepted, there should probably be a more elegant solution that doesn't break old content.
Your suggestions are welcome!
Fri, 02/10/2017 - 09:53
As otacke says the FITB
As otacke says the FITB activity is expecting plain text to be inserted in the blanks. Actually, things would be easier if the original programmer had decided to use the universally accepted character (in computing) for separating alternative elements "|", vertical bar aka pipe character!
As a provisional workaround, you might use that vertical bar for your fractions, of course making it clear to your users that that they have to use it (and HOW to produce that character on their keyboard).
Fri, 02/10/2017 - 12:05
Is it safe to assume that the
Is it safe to assume that the separator could be safely changed from / to | using the H5P content upgrade hook (compare e.g. upgrades.js in Interactive Video)? Or do you expect that someone used | within a solution for a blank? Introducing \ as escape character in general would help here, of course, and might be a nice contribution anyway.
Sun, 02/12/2017 - 11:52
Please comment on suggested solution
If we agree that replacing the forward slash / with a pipe character | to separate alternative solutions in the Blanks library, this would indeed need adding an upgrade rule in the upgrade.js. Since it seems that the use of the forward slash / separator causes a problem only in the case of fractions, I suggest a solution which does not rely on changing the separator. I have tried Otacke's suggestion of using the escape backslash character, but found it impossible to implement in my little search & replace routine. So I propose to use a double forward slash for fractions.
Here is an illustration of how it works for the question creator.
This fraction 8/12 can be simplified as *2//3/4//6* of course. The sum 4 can be obtained with *1+3/2+2/3+1/12//3*.
The first blank will accept "2/3" or "4/6" as correct answers. The second blank will accept "1+3" or "2+2" or "3+1" or "12/3".
One further problem is when asking for "show solutions", the forward slash is used, which makes fractions undistinguisable!
I suggest replacing the "show solutions" forward slash with a pipe character surrounded with blanks " | " so we have now:
See suggested routine on JSFiddle at https://jsfiddle.net/fwy6gt2z/2/
If people agree with my proposal I will pull a request to the H5P github.
Mon, 02/13/2017 - 07:34
I agree that there should definatly be a way to escape the slash. And it should be pretty simple to implement.
I created a Jira task so it can be fixed.
Mon, 02/13/2017 - 07:54
Hi Joseph and Oliver,
I'm did some refactoring on Drag Text (it has a similar case to this). Some text is parsed, and there are some "special characters" that are used.
Here is the old parsing code (similar to blanks case), and here is the refactored code, where a regex is used to split up the string.
It should be easy use a regex for the Blanks case, but also add an escape character.
What do you think?
PS: Look at how much more readable the code is in my refactored example! :)
Mon, 02/13/2017 - 09:57
Mmmmh, regexps :-)
Mmmmh, regexps :-)
Mon, 02/13/2017 - 16:32
How to test?
Yes, regex is probably the best way to go, and also try to have a more general solution than the one I provided. I've cloned the current h5p-drag-text library on my localhost Drupal development folder and switched to branch 'HFP-361-Accessibility'. However, when I try to view an activity created with that branch I get the error message:
Cannot read property 'AriaDrag' of undefined at new DragText (drag-text.js:64).
Tue, 02/14/2017 - 07:14
Not production ready
That branch isn't production ready yet, and I'm experimenting with a few things. I need to iron out the problems before I merge to master.
So you probably shouldn't play too much with it. But the TextParser works! :)
Sun, 02/12/2017 - 16:38
You made my day!
Wed, 11/14/2018 - 20:38
I was wondering if this feature would be added. I was hoping to use the Fill in the Blank to help assess html </html>. Thank you!
Thu, 11/15/2018 - 05:54
Hi bjuarez1,I'm sorry this
I'm sorry this task is still backlogged and not yet sellected for development.
Mon, 09/16/2019 - 01:50
/ still needed for medicine and nursing
I would like to ask a blood pressure reading for nurses and doctors.
The Blood Pressure 120/80 does not wor and needs to be split into two entries ie: *120*/*80*
It would be great to allow 120/80 with an escape charactier of some sort...