Javascript API FormUtil error

Confluence User - 16 Oct, 2020

I am following these instructions Javascript API#FormUtil to get the value of a field in a form.

The code is in a custom HTML field on the same form

However I am getting this error in my browser. Tried both Firefox and Chrome

I am using Joget DX Enterprise

Any ideas why?

form;javascript;formutil

6


16 Oct, 2020
confluenceUser
1
confluenceUser

Do attach your JS script here so the Joget community can understand this better.

16 Oct, 2020
confluenceUser
confluenceUser

Hi,

The script is very basic

<script type="text/javascript">
    var value = FormUtil.getValue("field1");
</script>


Why does it not see FormUtil?

From the instructions, since I am already in a form, this should work. But I am getting the error above.

16 Oct, 2020
confluenceUser
confluenceUser

Do try this from a different Joget instance. Perhaps try it in Joget Cloud where you can sign up for a free account.

This is to narrow down the scope of this issue.

16 Oct, 2020
confluenceUser
confluenceUser

I just noticed your script. Do enclose your JS logic in a document ready listener, and try again.

16 Oct, 2020
confluenceUser
confluenceUser

Thanks Chris,

Below is a bit more about the error

I am using Joget DX Enterprise installed on Ubuntu and connected via a SSH tunnel.

I will try again on a local install of Joget and report back soon


16 Oct, 2020
confluenceUser
confluenceUser

Just tried it with your suggestion to enclose with document and happy to report that it works!!!

<script type="text/javascript">

$(document).change(function(){
     var value = FormUtil.getValue("field1");

    alert(value);
});
</script>

Now I can see my values when I change my selectbox selections.

Thank you so much!

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print