# One-sided card effect

**URL:** <https://forums.ankiweb.net/t/one-sided-card-effect/21896>\
**Category:** Help\
**Created:** [July 31, 2022, 3:53pm UTC](https://forums.ankiweb.net/t/one-sided-card-effect/21896 "2022-07-31T15:53:04Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![yrocs](https://avatars.discourse-cdn.com/v4/letter/y/e99b99/32.png) [@yrocs](https://forums.ankiweb.net/u/yrocs)\
**Post date:** [July 31, 2022, 3:53pm UTC](https://forums.ankiweb.net/t/one-sided-card-effect/21896/1 "2022-07-31T15:53:04Z")

</div>

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](https://forums.ankiweb.net/t/how-can-i-see-only-the-front-of-the-card/5162/3) 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?

Thank you.

---

<div class="post-metadata">

**Author:** ![BlackBeans](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/blackbeans/32/2283_2.png) [@BlackBeans](https://forums.ankiweb.net/u/BlackBeans)\
**Post date:** [July 31, 2022, 6:12pm UTC](https://forums.ankiweb.net/t/one-sided-card-effect/21896/2 "2022-07-31T18:12:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![yrocs](https://avatars.discourse-cdn.com/v4/letter/y/e99b99/32.png) [@yrocs](https://forums.ankiweb.net/u/yrocs)\
**Post date:** [July 31, 2022, 7:33pm UTC](https://forums.ankiweb.net/t/one-sided-card-effect/21896/3 "2022-07-31T19:33:11Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![DiveShallow](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/diveshallow/32/823_2.png) [@DiveShallow](https://forums.ankiweb.net/u/DiveShallow)\
**Post date:** [July 31, 2022, 8:05pm UTC](https://forums.ankiweb.net/t/one-sided-card-effect/21896/4 "2022-07-31T20:05:15Z")

</div>

Set auto advance to 0 seconds and do nothing. Remove the Id=answer from any `<hr>` in template. Your cards are now one sided card.

---

<div class="post-metadata">

**Author:** ![yrocs](https://avatars.discourse-cdn.com/v4/letter/y/e99b99/32.png) [@yrocs](https://forums.ankiweb.net/u/yrocs)\
**Post date:** [July 31, 2022, 9:01pm UTC](https://forums.ankiweb.net/t/one-sided-card-effect/21896/5 "2022-07-31T21:01:46Z")

</div>

Thank you very much. I didn’t know about this feature. It’s a bit hacky but has the desired effect.

---

<div class="post-metadata">

**Author:** ![BlackBeans](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/blackbeans/32/2283_2.png) [@BlackBeans](https://forums.ankiweb.net/u/BlackBeans)\
**Post date:** [July 31, 2022, 9:08pm UTC](https://forums.ankiweb.net/t/one-sided-card-effect/21896/6 "2022-07-31T21:08:03Z")

</div>

> [@yrocs](#):
>
> Can you explain?

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.

---

<div class="post-metadata">

**Author:** ![yrocs](https://avatars.discourse-cdn.com/v4/letter/y/e99b99/32.png) [@yrocs](https://forums.ankiweb.net/u/yrocs)\
**Post date:** [July 31, 2022, 10:10pm UTC](https://forums.ankiweb.net/t/one-sided-card-effect/21896/7 "2022-07-31T22:10:23Z")

</div>

> [@BlackBeans](#):
>
> > [@yrocs](#):
> >
> > Can you explain?
> 
> 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.

---

<div class="post-metadata">

**Author:** ![BlackBeans](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/blackbeans/32/2283_2.png) [@BlackBeans](https://forums.ankiweb.net/u/BlackBeans)\
**Post date:** [August 1, 2022, 5:48am UTC](https://forums.ankiweb.net/t/one-sided-card-effect/21896/8 "2022-08-01T05:48:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![yrocs](https://avatars.discourse-cdn.com/v4/letter/y/e99b99/32.png) [@yrocs](https://forums.ankiweb.net/u/yrocs)\
**Post date:** [August 1, 2022, 4:46pm UTC](https://forums.ankiweb.net/t/one-sided-card-effect/21896/9 "2022-08-01T16:46:17Z")

</div>

> [@BlackBeans](#):
>
> 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](https://forums.ankiweb.net/t/how-can-i-see-only-the-front-of-the-card/5162/3) 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.

---

<div class="post-metadata">

**Author:** ![BlackBeans](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/blackbeans/32/2283_2.png) [@BlackBeans](https://forums.ankiweb.net/u/BlackBeans)\
**Post date:** [August 1, 2022, 5:18pm UTC](https://forums.ankiweb.net/t/one-sided-card-effect/21896/10 "2022-08-01T17:18:49Z")

</div>

It seems to me that the situation is not entierly clear, so I’ll explain every detail:

1. 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.
2. 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).
3. 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:

```nohighlight
{{Field}}
<script>document.onload = pycmd('ans');</script>

```

Now, on the backside, you don’t want to add `{{FrontSide}}`. Instead, put whatever you want to be your single-sided card content. Here you go!

---

<div class="post-metadata">

**Author:** ![yrocs](https://avatars.discourse-cdn.com/v4/letter/y/e99b99/32.png) [@yrocs](https://forums.ankiweb.net/u/yrocs)\
**Post date:** [August 1, 2022, 6:43pm UTC](https://forums.ankiweb.net/t/one-sided-card-effect/21896/11 "2022-08-01T18:43:42Z")

</div>

> [@BlackBeans](#):
>
> It seems to me that the situation is not entierly clear, so I’ll explain every detail:
> 
> 1. 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.

I understand.

> [@](#):
>
> 1. 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).

Good to know.

> [@](#):
>
> 1. 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.

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.

> [@](#):
>
> * * *
> 
> 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:
> 
> ```html
> {{Field}}
> <script>document.onload = pycmd('ans');</script>
> 
> ```
> 
> Now, on the backside, you don’t want to add `{{FrontSide}}`. Instead, put whatever you want to be your single-sided card content. Here you go!

Works! Thanks 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [May 1, 2023, 4:08am UTC](https://forums.ankiweb.net/t/one-sided-card-effect/21896/12 "2023-05-01T04:08:02Z")

</div>


