# Getting the Answer Text of "Basic type in the answer" Cards

**URL:** <https://forums.ankiweb.net/t/getting-the-answer-text-of-basic-type-in-the-answer-cards/68978>\
**Category:** Development\
**Created:** [February 24, 2026, 1:49pm UTC](https://forums.ankiweb.net/t/getting-the-answer-text-of-basic-type-in-the-answer-cards/68978 "2026-02-24T13:49:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheDarkRiddle](https://avatars.discourse-cdn.com/v4/letter/t/b487fb/32.png) [@TheDarkRiddle](https://forums.ankiweb.net/u/TheDarkRiddle)\
**Post date:** [February 24, 2026, 1:49pm UTC](https://forums.ankiweb.net/t/getting-the-answer-text-of-basic-type-in-the-answer-cards/68978/1 "2026-02-24T13:49:46Z")

</div>

### Hello Dear Anki Devs 🙂

I am working on a Add-on for my university, in which I want to save some data about the card, the user answered. For Example, how long did the user took to answer, or what card the user answered.

**What is my goal?**  
Save the text of the card in a temporary object. Including “Question” and “Answer” texts of the card.

**What is my Problem?**  
The text I am getting from the Anki Card Object is the front HTML of the card with an ID-Tag, or sometimes empty. I could not figure out when it is empty. Maybe just a code error on my side.

**What have I tried?**  
The following:

I found a method of extracting the “Question” of a card via python:

```python
temp_card_data.question = data.render_output().question_text

```

which works as expected. The content of ‘temp\_card\_data.question‘ is the plain text the card holds in it’s “Question-Field” without HTML.

Then I tried the following for the “Answer” text, in this case for a simple ‘print’ statement:

```python
print("Answer Text_'data.answer()': " + str(data.answer()))
        print("Answer Text_'render_output().answer_text': " + str(data.render_output().answer_text))

```

The first one results in the following console-output:

```bash
Answer Text_'data.answer()': <style>.card {
    font-family: arial;
    font-size: 20px;
    line-height: 1.5;
    text-align: center;
    color: black;
    background-color: white;
}
</style>Welche Frabe hat die Sonne?

<hr id=answer>

[[type:Back]]

```

It includes some formatting information, the “Question” text and ‘

* * *
‘

The second try ‘data.render\_output().answer\_text‘ results in this one:

```bash
Answer Text_'render_output().answer_text': Welche Frabe hat die Sonne?

<hr id=answer>

[[type:Back]]

```

Which is only missing the style-tag.

**Question**

How is it possible to get the clean rendered text of the “Answer” field? For “Basic type in the answer” Cards.

More Detail of the Card I am using to test this in the png’s.  
I am happy for any bit of help and looking forward to chat, Moritz (:

---

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [February 25, 2026, 2:23am UTC](https://forums.ankiweb.net/t/getting-the-answer-text-of-basic-type-in-the-answer-cards/68978/2 "2026-02-25T02:23:58Z")

</div>

Do you mean you want the type-in field rendered as HTML? That’s not available as a standalone method, but you can copy the code used in the reviewer to render the input:

> <https://github.com/ankitects/anki/blob/07c2b0310f3754eff33653d10885d58bbcb471ab/qt/aqt/reviewer.py#L699>

---

<div class="post-metadata">

**Author:** ![TheDarkRiddle](https://avatars.discourse-cdn.com/v4/letter/t/b487fb/32.png) [@TheDarkRiddle](https://forums.ankiweb.net/u/TheDarkRiddle)\
**Post date:** [February 27, 2026, 10:02am UTC](https://forums.ankiweb.net/t/getting-the-answer-text-of-basic-type-in-the-answer-cards/68978/3 "2026-02-27T10:02:53Z")

</div>

Thank you for you’r reply (: I dont think I want the Input, when Input is what the user typed in.  
Or I misunderstood you.

And I think I have a better example, to explain what I want to archive:

 ![Card_Example](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/8/1/8173245ab7f7669821d3763ad5ad94b2a90eac67.png)This is my Type in the Answer Card. It has the Question Text “Welche Farbe hat das Wasser?” and the Answer Text “Blau”.

Now, in my own code, which gets executed in the “reviewer\_did\_answer\_trigger()“.

When I execute the following lines of Code on a Normal Card:

```python
temp_card_data.question = data.render_output().question_text
temp_card_data.answer = data.render_output().answer_text

```

After that, the fields `temp_card_data.question` holds the String “Welche Farbe hat das Wasser?“  
and the `temp_card_data.answer` holds the string “Blau“.

If I execute the lines on a “Type in the answer card” I get:  
`temp_card_data.question` holds the String “Welche Farbe hat das Wasser?“  
`temp_card_data.answer` holds the string “Welche Farbe hat das Wasser?

* * *

[[type:Back]]“.

But I would like to get “Blau”. And that is what confuses me.

---

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [February 27, 2026, 10:39am UTC](https://forums.ankiweb.net/t/getting-the-answer-text-of-basic-type-in-the-answer-cards/68978/4 "2026-02-27T10:39:27Z")

</div>

> [@TheDarkRiddle](#):
>
> But I would like to get “Blau”. And that is what confuses me.

If you have access to a Card object and you want to get fields contents, use something like this:

```auto
note = card.note()
field = note["Back"]

```

---

<div class="post-metadata">

**Author:** ![TheDarkRiddle](https://avatars.discourse-cdn.com/v4/letter/t/b487fb/32.png) [@TheDarkRiddle](https://forums.ankiweb.net/u/TheDarkRiddle)\
**Post date:** [March 2, 2026, 7:47am UTC](https://forums.ankiweb.net/t/getting-the-answer-text-of-basic-type-in-the-answer-cards/68978/5 "2026-03-02T07:47:21Z")

</div>

Thank you very much 😁 this was exactly what I searched for, I am very happy. Have a lovely week!

---

<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:** [April 1, 2026, 7:48am UTC](https://forums.ankiweb.net/t/getting-the-answer-text-of-basic-type-in-the-answer-cards/68978/6 "2026-04-01T07:48:18Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
