There are some things that I find I learn best simply by re-reading again and again over time, rather than by trying to “test” my memory. Therefore, I’m interested in a one-sided card as a study option in Anki (just like the “Back Side Only” option in the browser preview). I don’t know if there are any plans to add this feature to Anki, but in the meantime, I tried this solution based on JavaScript and Python that the poster says automatically advances you to the back side of a card:
make the Front Template
<script>document.onload = pycmd('ans');</script>
which will simply advanced to the back of the card. Then make the Back Template:
{{Front}}
This didn’t work for me. First of all, Anki gives an error message that there’s no field in the front template (apparently, this is mandatory). So I tried leaving the {{Front}} field in the front template. This allows me to create the template, but the solution simply doesn’t work (cards don’t automatically advance to the back side).
So is there any way using JavaScript to create a one-sided card effect?
This only works on certain platforms. It should work on Anki Desktop, I think it doesn’t work on AnkiMobile and I am almost sure it won’t work on AnkiDroid or on AnkiWeb.
Thanks for your reply. Well like I said, Anki Desktop (2.1.53) is not letting me create a template with no Front Template fields. When I click the Save button to save the template, Anki gives the error message:
Card template 1 in notetype ‘One-Sided’ has a problem.
Expected to find a field replacement on the front of the card template.
Can you explain? Do you know of any other solutions that would work (on Desktop and, preferably, on Ankimobile, too).
Yes well Anki is designed to have cards with two sides, and the content of the card is supposed to linked in some way to whatever you are trying to learn, so if you put no field on the front side of the card, Anki will detect that there is something wrong, so it won’t let you do that.
Right. What I meant was, you said the purported solution I linked to in my original post should work on Anki desktop. So how is it that it should work if, by your own admission, Anki won’t let you put zero fields on the front side. That’s what I was asking you to explain.
What should work is the pycmd('ans') call. Keep in mind that it’s not part of an exposed API, so you are not “supposed” to be able to call it, it just happens to work on some platforms (Anki Desktop).
What will never work is to not put an field in the front side of a card template, because then Anki will detect that, when you review that card, whatever it will show you will not depend on the content you are trying to memorize (whatever might that be), so there is a problem.
So we’ve established that calling pycmd('ans') from the front template doesn’t work (despite Snoyes’ post I suppose). OK. But the obvious question you’ve been leaving unanswered is, how exactly do you use pycmd('ans') in order to advance cards automatically to the back side. Please keep in mind, I’m just an Anki user—I know note types, I know card types, I know search strings, etc. But I have little familiarity with JavaScript, and even less so with Python. And I know essentially nothing about Anki’s internals. It’s not at all obvious to me how to do this, so if you could state specifically what I’m supposed to do with pycmd('ans'), that would be helpful. Thanks.
It seems to me that the situation is not entierly clear, so I’ll explain every detail:
A single-side card / automatically advancing is not a feature of Anki. Any solution to achieve that is a hack (in the sense that it is not “officially” supported, not in the sense that it is illegal or something like that) — that is, if there is a solution at all, which is not guaranteed.
Turns out there is an unexposed interface between JavaScript and Python (pycmd) in Anki Desktop. Through that interface, it is possible to advance to the answer side within JavaScript (by calling pycmd('ans')). However, this won’t work outside of Anki Desktop (as other clients aren’t even written in Python) and should not be considered stable: this “feature” could be removed or modified at any time, without any warnings (even though, to reassure you, it’s probably not going to change everyday).
The error Anki gives you is unrelated to all I have said above. It’s only related to the fact that you must have a field in the front side of a card template, otherwise Anki (which thinks you’re only going to see the front side first) understands there is an issue.
That being said, back to the hacky solution. To patch the required field warning, you just need to put any field in the front template. It doesn’t matter which one since the purpose is to skip the front side at all! To do so, assuming there is a field called Field (replace with whichever you actually have), put in the front side:
OK, this was the only thing missing from snoyes’ posted solution. Otherwise it was fine (same as yours). I should also say I did try leaving {{Front}} on the front side template (as I mentioned in my original post), but I was only testing it in the browser preview, where the hack doesn’t work, and I wrongly assumed that it therefore wouldn’t work in the deck either. I should have also tested in an actual deck.