Jump to content

Currency value in Details Page


Recommended Posts

Hi! I just want to share something related to the Currency field on a details page. As of now, if we try to make a Currency field editable on the details page (Changing its form element from 'Display Only' into 'Text Field'), the dollar sign and trailing zero is automatically removed from its decimal. 

Here is the behavior of the Currency Field in 'Display Only' form element: 
image.png.a86f70063ea1fd67faaf3f59c78a63c9.png
And, it displays differently when changed into 'Text Field' form element:
image.png.861fe5ef16b1a24c4217cd76e3a4f836.png
 

 

Link to comment
Share on other sites

Since changing the form element into 'Text Field' removes the value's dollar sign and zero in its decimal, one solution for this is the following JavaScript code. Kindly try this on the Footer section of your Details Page: 

 

<span style="display: none" id="tablevalue">[@field:CurrencyNumber$]</span>

<script type="text/javascript">

document.addEventListener('DataPageReady', function (event) {

var field = document.querySelector("#EditRecordCurrencyNumber");

var tablevalue =  document.querySelector("#tablevalue").innerHTML;

field.value = tablevalue;

});

</script>


Note: Just change all the 'CurrencyNumber' in the code into your Currency field name.
 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...