Custom card problem

I’m having a problem with a custom card I created that work in conjunction with an addon called MIA Japanese.

It works just fine, but sometimes, sometimes when I edit the card, sometimes for no reason, the front of the card stop working and shows the message error “The front of this card is blank”. It happened many times, and I needed to try many things like opening and closing the cards tab, reinstalling Anki and many more I don’t remember. Sometimes it works, sometime it doesn’t.

My custom card is a clone from the official one, which works fine in the desktop Anki, I tried to see what differences were in the code through some text comparators, but the only ones I could find was my modifications which didn’t mess up anything before.
But the funny part isn’t it though. with my custom card, This problem ONLY applies to the destkop Anki. I can access perfectly normal my cards’ front and back through the Anki Web, but when I try to see it on the Desktop Anki, it simply won’t work because is says “The front of the card is blank” even though it’s obviously not. It also shows everything normal on the card editor tab.

Here you can see both the official as the custom front and back of the cards:

I’m just very curious about this inconsistent problem. Why it happens, and why it only affects the Desktop version of Anki? I don’t understand something can just magically stop working, even though nothing has changed and it is the same thing as the original from the addon…

I see you changed field names. I guess you have spelled right as I don’t know the name of your fields. This template heavily relies on Javascript, so I guess that could be playing a role.

The second instance of {{#Audio na Frente}} and {{/Audio na Frente}} is not needed. You can simplify:

{{#Audio na Frente}}
{{#Audio}}<span class="expression-field">{{Audio}} Áudio</span>{{/Audio}}
{{^Audio}}<span class="expression-field"><div display-type="coloredhover" class="wrapped-japanese">{{Frase}}</div></span>{{/Audio}}
{{/Audio na Frente}}

I supposed that too, but that’s where the “I used a text comparator” enters in action: there is no difference between the original and my custom card, nor in the Javascript nor in the fields that isn’t the simple translation of the words, but that’s enough, for some reason, to make my custom card not work while the official one works just fine, and icredibly ONLY in Desktop Anki. That is what I don’t understand, how it works perfectly fine on Anki Web but not on the Desktop Version.

The javascript code is a one-liner without spaces, so is rather oscure to read. I guess there is a dependancy for their add-on or either the name of the fields. Additionally MIA team only updates their add-ons in a 6 month Development Cycles, so using yet-unsuported versions i.e. 2.1.24 or newer could cause issues. You can contact them to get support.

1 Like

That would still not make sense. I don’t use the latest version, so that wouldn’t be a factor here.

And it was working perfectly fine till I decided to test a thing, deleting a field and putting it back just for a second as it was, and not in the front but in the back of the card and it stopped working once more…

When you delete a field from the note type, all references to it in all card templates are also deleted. So when you create the field again, no instances of field references are rebuilt. You can change the notetype to a new clone from original MIA notype and change only the name of the fields to see if changing only that does not mess things arround.

1 Like

Actually I meant the “{{whatever name}}” in the card editor, not the field editor.

Ok… For some WEIRD reason, putting:

<div display-type="coloredhover" class="wrapped-japanese">{{Frase}}</div>

and commenting it so it doesn’t interfere in the cards made it work e.e