Error when using formInputs:'get value' called on an object that does not implement interface HTMLInputElement.

332 views
Skip to first unread message

MC_NeuroEcon

unread,
May 23, 2022, 10:48:01 PM5/23/22
to oTree help & discussion
Hello,

I wonder if anyone has some insight here. I am trying to use formInputs.field_name.value and see:

"Uncaught TypeError: 'get value' called on an object that does not implement interface HTMLInputElement."

in latest Firefox and a similar error in Chrome. My code is very simple:

{% block content %}
{{ formfield 'comprehension4' }}
<button type="button" onclick="check_comprehension4()">Check the answer</button>
<p>

{% endblock %}

{% block scripts %}

<script>

function check_comprehension4() {
    let comprehension_check_value = formInputs.comprehension4.value;
    console.log(comprehension_check_value);
    if (comprehension_check_value != 3.00) {
      alert("Not correct, try again");
    }
}
</script>
{% endblock %}


When I inspect the javascript object that formInputs.comprehension4 gives, I can see that "value" is correct. However, when I try to access using formInputs.comprehension4.value I see this error.

Thanks for your time!

Chris @ oTree

unread,
May 23, 2022, 11:46:21 PM5/23/22
to oTree help & discussion
OK, I can confirm this bug...I will fix ASAP. In the meanwhile you can downgrade to 5.8.1.
Thanks for reporting!
Chris

Chris @ oTree

unread,
May 23, 2022, 11:54:40 PM5/23/22
to oTree help & discussion
I have fixed it, just published an upgrade.

MC_NeuroEcon

unread,
May 24, 2022, 12:22:48 PM5/24/22
to oTree help & discussion
Thank you!
Reply all
Reply to author
Forward
0 new messages