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

Question

Question

How to dynamically change the currency symbol in Forms

asked on July 17, 2015

Hi,

I would like to know how to dynamically change the currency symbol used on a form in javascript. I will have a drop-down field that a user will change to the currency desired. I then want to change the currency field(s) to reflect the correct symbol.

Thanks

Sheldon

0 0

Answer

SELECTED ANSWER
replied on July 17, 2015

Is the currency dropdown in plaintext? Would it perhaps include at the beginning or end the symbol you desire instead of the current currency symbol?

 

We can definitely find a way to handle this task, but I would like to warn you up front that it may not appear changed when saved to the repository or if the user can print after submitting. The JavaScript will only change it on the browser representation of the page.

 

So, just a little start, we can change that currency symbol by using the proper selector for that.

$('#q5 .margin-end').text('#');

In the example above, I used field5 and changed the '$' to '#'. If we use that within a function where we check the value of the dropdown and assign a new character based on the selection, then we will simply need to add an event action listener to call our new function whenever the dropdown has changed.

2 0

Replies

replied on July 18, 2015

Hi Kenneth,

Thank you very much for the code. This is definitely in line with what I need on the front end and will work.

You mentioned that the resulting image in the repository will not reflect the same, which is going to pose a problem for my users who view the document as part of the workflow. Would be great if someone had some insight into why that would be and if there is a solution.

Thanks

Sheldon

0 0
replied on July 19, 2015

To let the JavaScript code work on file saved to repository, you need to change the JavaScript to execute on form load instead of on field value change.

That is, when in new submission you may have the code to change currency symbol when drop-down field value changes, but for file saved to repository, you should have the code to change currency symbol on form load based on the field value.

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

Sign in to reply to this post.