You are viewing limited content. For full access, please sign in.

Question

Question

If I assign a value to a field in Forms using Javascript, will that field value be visible in the repository?

asked on July 21, 2021

I am using JS to calculate and assign a value to a form field. When the form gets submitted and uploaded to the repository, the field appears blank.

If this is the default behavior, is there a work around that I can do to get the value to appear in the repository?

 

1 0

Answer

SELECTED ANSWER
replied on July 21, 2021

If you use Forms to make the field read-only, the JS value will show up on the form, but the form will drop the value thinking it's supposed to stay blank and read-only. 

Deselect the read-only property in the form and use JS to make the field read-only as well. That way, users won't be able to edit it, but the form will accept the value. 

3 0

Replies

replied on July 21, 2021

Is the field read only? If you go to the monitor page and view the variable data, is it blank there? 

How did you use JS to fill the field? 

0 0
replied on July 21, 2021

Ah yes the field is currently set to read only.

The monitor page shows the variable to be blank.

I filled the field by using in essence the .val() function for jquery.


Ex. $('#q1 input').val(calculationAnswer);

 

The reason I have it set to read-only is because I want the user to be able to see the value but not able to edit it.

0 0
SELECTED ANSWER
replied on July 21, 2021

If you use Forms to make the field read-only, the JS value will show up on the form, but the form will drop the value thinking it's supposed to stay blank and read-only. 

Deselect the read-only property in the form and use JS to make the field read-only as well. That way, users won't be able to edit it, but the form will accept the value. 

3 0
replied on July 21, 2021

Awesome! Thanks Jared!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.